summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorAmol Grover <frextrite@gmail.com>2020-04-06 16:29:50 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-01 13:18:13 +0200
commit8ebf2b77d7e5687d49fd9a1505d7fe30009a8433 (patch)
treebeb91313623e081957f53628c5967f5c908733f2 /security
parent5b84cd71c1da50fb99cd81d526563ed2e3a93c1b (diff)
device_cgroup: Fix RCU list debugging warning
[ Upstream commit bc62d68e2a0a69fcdcf28aca8edb01abf306b698 ] exceptions may be traversed using list_for_each_entry_rcu() outside of an RCU read side critical section BUT under the protection of decgroup_mutex. Hence add the corresponding lockdep expression to fix the following false-positive warning: [ 2.304417] ============================= [ 2.304418] WARNING: suspicious RCU usage [ 2.304420] 5.5.4-stable #17 Tainted: G E [ 2.304422] ----------------------------- [ 2.304424] security/device_cgroup.c:355 RCU-list traversed in non-reader section!! Signed-off-by: Amol Grover <frextrite@gmail.com> Signed-off-by: James Morris <jmorris@namei.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'security')
-rw-r--r--security/device_cgroup.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index 725674f3276d..5d7bb91c6487 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -352,7 +352,8 @@ static bool match_exception_partial(struct list_head *exceptions, short type,
{
struct dev_exception_item *ex;
- list_for_each_entry_rcu(ex, exceptions, list) {
+ list_for_each_entry_rcu(ex, exceptions, list,
+ lockdep_is_held(&devcgroup_mutex)) {
if ((type & DEVCG_DEV_BLOCK) && !(ex->type & DEVCG_DEV_BLOCK))
continue;
if ((type & DEVCG_DEV_CHAR) && !(ex->type & DEVCG_DEV_CHAR))