cfg80211: fix P2P-Device stop locking
authorJohannes Berg <johannes.berg@intel.com>
Fri, 19 Apr 2013 10:18:19 +0000 (12:18 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 22 Apr 2013 13:31:47 +0000 (15:31 +0200)
cfg80211_stop_p2p_device() requires the devlist_mtx to
be held, but nl80211_stop_p2p_device() doesn't acquire
it which is a locking error and causes a warning (when
lockdep is enabled). Fix this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/nl80211.c

index 212d2aa7a1c58b6673d9ebdc63bb7373f5d713db..3abcbbada6d42b729a62b682cea9b4df1af98fe4 100644 (file)
@@ -8159,9 +8159,11 @@ static int nl80211_stop_p2p_device(struct sk_buff *skb, struct genl_info *info)
        if (!rdev->ops->stop_p2p_device)
                return -EOPNOTSUPP;
 
+       mutex_lock(&rdev->devlist_mtx);
        mutex_lock(&rdev->sched_scan_mtx);
        cfg80211_stop_p2p_device(rdev, wdev);
        mutex_unlock(&rdev->sched_scan_mtx);
+       mutex_unlock(&rdev->devlist_mtx);
 
        return 0;
 }