Skip to content
Commit f2ac54eb authored by Johannes Berg's avatar Johannes Berg
Browse files

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



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>
parent b2f750c3
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