aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/gcc-plugins/gcc-common.h
diff options
context:
space:
mode:
authorQian Cai <[email protected]>2020-03-30 21:30:02 +0000
committerIngo Molnar <[email protected]>2020-04-08 10:05:06 +0000
commitd22cc7f67d55ebf2d5be865453971c783e9fb21a (patch)
tree1330785754a3c2b269d797a9da763011e37e39ec /scripts/gcc-plugins/gcc-common.h
parentMerge tag 'drm-next-2020-04-08' of git://anongit.freedesktop.org/drm/drm (diff)
downloadkernel-d22cc7f67d55ebf2d5be865453971c783e9fb21a.tar.gz
kernel-d22cc7f67d55ebf2d5be865453971c783e9fb21a.zip
locking/percpu-rwsem: Fix a task_struct refcount
The following commit: 7f26482a872c ("locking/percpu-rwsem: Remove the embedded rwsem") introduced task_struct memory leaks due to messing up the task_struct refcount. At the beginning of percpu_rwsem_wake_function(), it calls get_task_struct(), but if the trylock failed, it will remain in the waitqueue. However, it will run percpu_rwsem_wake_function() again with get_task_struct() to increase the refcount but then only call put_task_struct() once the trylock succeeded. Fix it by adjusting percpu_rwsem_wake_function() a bit to guard against when percpu_rwsem_wait() observing !private, terminating the wait and doing a quick exit() while percpu_rwsem_wake_function() then doing wake_up_process(p) as a use-after-free. Fixes: 7f26482a872c ("locking/percpu-rwsem: Remove the embedded rwsem") Suggested-by: Peter Zijlstra <[email protected]> Signed-off-by: Qian Cai <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
Diffstat (limited to 'scripts/gcc-plugins/gcc-common.h')
0 files changed, 0 insertions, 0 deletions