diff options
author | Kees Cook <keescook@chromium.org> | 2014-12-12 13:36:49 +1030 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2014-12-18 12:38:51 +1030 |
commit | b0a65b0cccd477b2fd8b7adad0ac39433df54829 (patch) | |
tree | cd34e0b1dfae25117f114becd0b5153133193098 /lib | |
parent | 18eb74fa94161380c1acc9cf562cb835c4e54a25 (diff) |
param: do not set store func without write perm
When a module_param is defined without DAC write permissions, it can
still be changed at runtime and updated. Drivers using a 0444 permission
may be surprised that these values can still be changed.
For drivers that want to allow updates, any S_IW* flag will set the
"store" function as before. Drivers without S_IW* flags will have the
"store" function unset, unforcing a read-only value. Drivers that wish
neither "store" nor "get" can continue to use "0" for perms to stay out
of sysfs entirely.
Old behavior:
# cd /sys/module/snd/parameters
# ls -l
total 0
-r--r--r-- 1 root root 4096 Dec 11 13:55 cards_limit
-r--r--r-- 1 root root 4096 Dec 11 13:55 major
-r--r--r-- 1 root root 4096 Dec 11 13:55 slots
# cat major
116
# echo -1 > major
-bash: major: Permission denied
# chmod u+w major
# echo -1 > major
# cat major
-1
New behavior:
...
# chmod u+w major
# echo -1 > major
-bash: echo: write error: Input/output error
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions