linux/security
Jann Horn 198f512652 device_cgroup: fix RCU imbalance in error case
commit 0fcc4c8c04 upstream.

When dev_exception_add() returns an error (due to a failed memory
allocation), make sure that we move the RCU preemption count back to where
it was before we were called. We dropped the RCU read lock inside the loop
body, so we can't just "break".

sparse complains about this, too:

$ make -s C=2 security/device_cgroup.o
./include/linux/rcupdate.h:647:9: warning: context imbalance in
'propagate_exception' - unexpected unlock

Fixes: d591fb5661 ("device_cgroup: simplify cgroup tree walk in propagate_exception()")
Signed-off-by: Jann Horn <jannh@google.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2019-08-13 12:38:47 +01:00
..
apparmor apparmor: provide userspace flag indicating binfmt_elf_mmap change 2019-05-02 21:42:07 +01:00
integrity ima: fix showing large 'violations' or 'runtime_measurements_count' 2019-02-11 17:53:30 +00:00
keys KEYS: always initialize keyring_index_key::desc_len 2019-05-02 21:41:58 +01:00
selinux selinux: avoid silent denials in permissive mode under RCU walk 2019-07-09 22:03:45 +01:00
smack security: let security modules use PTRACE_MODE_* with bitmasks 2018-01-01 20:52:10 +00:00
tomoyo get rid of pointless checks for NULL ->i_op 2014-04-01 23:19:16 -04:00
yama Yama: Check for pid death before checking ancestry 2019-05-02 21:41:23 +01:00
capability.c Merge tag 'keys-20140314' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs into next 2014-04-14 11:42:49 +10:00
commoncap.c ptrace: use fsuid, fsgid, effective creds for fs access checks 2017-09-15 18:30:17 +01:00
device_cgroup.c device_cgroup: fix RCU imbalance in error case 2019-08-13 12:38:47 +01:00
inode.c sysfs: Create mountpoints with sysfs_create_mount_point 2015-08-20 18:24:03 +01:00
Kconfig KPTI: Rename to PAGE_TABLE_ISOLATION 2018-01-09 00:35:20 +00:00
lsm_audit.c audit: anchor all pid references in the initial pid namespace 2014-03-20 10:11:55 -04:00
Makefile security: cleanup Makefiles to use standard syntax for specifying sub-directories 2014-02-17 11:08:04 +11:00
min_addr.c mmap_min_addr check CAP_SYS_RAWIO only for write 2010-04-23 08:56:31 +10:00
security.c vfs: Commit to never having exectuables on proc and sysfs. 2017-04-04 22:21:56 +01:00