diff options
| author | Alexey Dobriyan <adobriyan@gmail.com> | 2018-08-21 21:54:30 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-22 10:52:45 -0700 |
| commit | 41089b6d3e44a895076cc8ce56b08e463cb4f796 (patch) | |
| tree | 1ecc2775586c88c324f6fc9987c4ab2ca2f6b9a3 /scripts/patch-kernel | |
| parent | proc: put task earlier in /proc/*/fail-nth (diff) | |
| download | linux-41089b6d3e44a895076cc8ce56b08e463cb4f796.tar.gz linux-41089b6d3e44a895076cc8ce56b08e463cb4f796.zip | |
proc: save 2 atomic ops on write to "/proc/*/attr/*"
Code checks if write is done by current to its own attributes.
For that get/put pair is unnecessary as it can be done under RCU.
Note: rcu_read_unlock() can be done even earlier since pointer to a task
is not dereferenced. It depends if /proc code should look scary or not:
rcu_read_lock();
task = pid_task(...);
rcu_read_unlock();
if (!task)
return -ESRCH;
if (task != current)
return -EACCESS:
P.S.: rename "length" variable. Code like this
length = -EINVAL;
should not exist.
Link: http://lkml.kernel.org/r/20180627200218.GF18113@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/patch-kernel')
0 files changed, 0 insertions, 0 deletions
