Skip to content

Commit

Permalink
device_cgroup: Fix RCU list debugging warning
Browse files Browse the repository at this point in the history
[ Upstream commit bc62d68 ]

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>
  • Loading branch information
frextrite authored and gregkh committed Oct 1, 2020
1 parent 5b84cd7 commit 8ebf2b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion security/device_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 8ebf2b7

Please sign in to comment.