linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] cfg80211: fix P2P-Device stop locking
@ 2013-04-19 10:26 Johannes Berg
  2013-04-19 10:26 ` [PATCH 2/2] cfg80211: invert P2P-Device vs. netdev check ordering Johannes Berg
  2013-04-22 13:35 ` [PATCH 1/2] cfg80211: fix P2P-Device stop locking Johannes Berg
  0 siblings, 2 replies; 3+ messages in thread
From: Johannes Berg @ 2013-04-19 10:26 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 212d2aa..3abcbba 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -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;
 }
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] cfg80211: invert P2P-Device vs. netdev check ordering
  2013-04-19 10:26 [PATCH 1/2] cfg80211: fix P2P-Device stop locking Johannes Berg
@ 2013-04-19 10:26 ` Johannes Berg
  2013-04-22 13:35 ` [PATCH 1/2] cfg80211: fix P2P-Device stop locking Johannes Berg
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2013-04-19 10:26 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

In cfg80211_can_use_iftype_chan(), check for P2P Device
first, and then for netdevs. This doesn't really change
anything but makes the code a bit easier to read since
it may not be obvious for everyone at first that a P2P
device has no netdev.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/wireless/util.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/wireless/util.c b/net/wireless/util.c
index 3d8a133..a7046a4 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1278,12 +1278,12 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
 	list_for_each_entry(wdev_iter, &rdev->wdev_list, list) {
 		if (wdev_iter == wdev)
 			continue;
-		if (wdev_iter->netdev) {
-			if (!netif_running(wdev_iter->netdev))
-				continue;
-		} else if (wdev_iter->iftype == NL80211_IFTYPE_P2P_DEVICE) {
+		if (wdev_iter->iftype == NL80211_IFTYPE_P2P_DEVICE) {
 			if (!wdev_iter->p2p_started)
 				continue;
+		} else if (wdev_iter->netdev) {
+			if (!netif_running(wdev_iter->netdev))
+				continue;
 		} else {
 			WARN_ON(1);
 		}
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] cfg80211: fix P2P-Device stop locking
  2013-04-19 10:26 [PATCH 1/2] cfg80211: fix P2P-Device stop locking Johannes Berg
  2013-04-19 10:26 ` [PATCH 2/2] cfg80211: invert P2P-Device vs. netdev check ordering Johannes Berg
@ 2013-04-22 13:35 ` Johannes Berg
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2013-04-22 13:35 UTC (permalink / raw)
  To: linux-wireless

Applied both.

johannes


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-22 13:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-19 10:26 [PATCH 1/2] cfg80211: fix P2P-Device stop locking Johannes Berg
2013-04-19 10:26 ` [PATCH 2/2] cfg80211: invert P2P-Device vs. netdev check ordering Johannes Berg
2013-04-22 13:35 ` [PATCH 1/2] cfg80211: fix P2P-Device stop locking Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).