Skip to content
Commit 47993576 authored by Johannes Berg's avatar Johannes Berg Committed by Greg Kroah-Hartman
Browse files

net: rfkill: reduce data->mtx scope in rfkill_fop_open



commit f2ac54eb upstream.

In syzbot runs, lockdep reports that there's a (potential)
deadlock here of data->mtx being locked recursively. This
isn't really a deadlock since they are different instances,
but lockdep cannot know, and teaching it would be far more
difficult than other fixes.

At the same time we don't even really _need_ the mutex to
be locked in rfkill_fop_open(), since we're modifying only
a completely fresh instance of 'data' (struct rfkill_data)
that's not yet added to the global list.

However, to avoid any reordering etc. within the globally
locked section, and to make the code look more symmetric,
we should still lock the data->events list manipulation,
but also need to lock _only_ that. So do that.

Reported-by: default avatar <syzbot+509238e523e032442b80@syzkaller.appspotmail.com>
Fixes: 2c3dfba4 ("rfkill: sync before userspace visibility/changes")
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2ca52108
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment