Skip to contentSkip to conversation

mac80211: fix recursive locking in ieee80211_sta_expire

PATCH In review Jiri Slaby 4 participants 8 messages Apr 7, 2008 – Apr 9, 2008 mac80211

lore
Share & tools
lore
author
#1 lore raw

PATCH 2/2 mac80211: fix defined but not used

In reply to Jiri Slaby

These two symbols are used only in ifdeffed function. Move them to that section too.
net/mac80211/sta_info.c:387: warning: __sta_info_pin' defined but not used net/mac80211/sta_info.c:397: warning: __sta_info_unpin' defined but not used

Cc Michael Wu <[email protected]>
Cc Johannes Berg <[email protected]>
Cc Jiri Benc <[email protected]>
---
 net/mac80211/sta_info.c |   60 +++++++++++++++++++++++-----------------------
 1 files changed, 30 insertions(+), 30 deletions(-)
net/mac80211/sta_info.c +30 -30
index ba02b43..e30426e 100644
@@ -379,36 +379,6 @@ void sta_info_clear_tim_bit(struct sta_info *sta)
 	spin_unlock_irqrestore(&sta->local->sta_lock, flags);
 }
 
-/*
- * See comment in __sta_info_unlink,
- * caller must hold local->sta_lock.
- */
-static void __sta_info_pin(struct sta_info *sta)
-{
-	WARN_ON(sta->pin_status != STA_INFO_PIN_STAT_NORMAL);
-	sta->pin_status = STA_INFO_PIN_STAT_PINNED;
-}
-
-/*
- * See comment in __sta_info_unlink, returns sta if it
- * needs to be destroyed.
- */
-static struct sta_info *__sta_info_unpin(struct sta_info *sta)
-{
-	struct sta_info *ret = NULL;
-	unsigned long flags;
-
-	spin_lock_irqsave(&sta->local->sta_lock, flags);
-	WARN_ON(sta->pin_status != STA_INFO_PIN_STAT_DESTROY &&
-		sta->pin_status != STA_INFO_PIN_STAT_PINNED);
-	if (sta->pin_status == STA_INFO_PIN_STAT_DESTROY)
-		ret = sta;
-	sta->pin_status = STA_INFO_PIN_STAT_NORMAL;
-	spin_unlock_irqrestore(&sta->local->sta_lock, flags);
-
-	return ret;
-}
-
 void __sta_info_unlink(struct sta_info **sta)
 {
 	struct ieee80211_local *local = (*sta)->local;
@@ -565,6 +535,36 @@ static void sta_info_cleanup(unsigned long data)
 }
 
 #ifdef CONFIG_MAC80211_DEBUGFS
+/*
+ * See comment in __sta_info_unlink,
+ * caller must hold local->sta_lock.
+ */
+static void __sta_info_pin(struct sta_info *sta)
+{
+	WARN_ON(sta->pin_status != STA_INFO_PIN_STAT_NORMAL);
+	sta->pin_status = STA_INFO_PIN_STAT_PINNED;
+}
+
+/*
+ * See comment in __sta_info_unlink, returns sta if it
+ * needs to be destroyed.
+ */
+static struct sta_info *__sta_info_unpin(struct sta_info *sta)
+{
+	struct sta_info *ret = NULL;
+	unsigned long flags;
+
+	spin_lock_irqsave(&sta->local->sta_lock, flags);
+	WARN_ON(sta->pin_status != STA_INFO_PIN_STAT_DESTROY &&
+		sta->pin_status != STA_INFO_PIN_STAT_PINNED);
+	if (sta->pin_status == STA_INFO_PIN_STAT_DESTROY)
+		ret = sta;
+	sta->pin_status = STA_INFO_PIN_STAT_NORMAL;
+	spin_unlock_irqrestore(&sta->local->sta_lock, flags);
+
+	return ret;
+}
+
 static void sta_info_debugfs_add_work(struct work_struct *work)
 {
 	struct ieee80211_local *local =
Signature · 1 line
1.5.4.4

Jiri Slaby

author
#0 lore raw

PATCH 1/2 mac80211: fix recursive locking in ieee80211_sta_expire

Hi,

it's against -mm, what's current mac80211 git tree? It seems that -mm has fresher material, than wireless-2.6...

--

ieee80211_sta_expire grabs local->sta_lock and calls sta_info_unlink which tries to grab the lock again. (make available) and use __sta_info_unlink variant instead.

Cc Michael Wu <[email protected]>
Cc Johannes Berg <[email protected]>
Cc Jiri Benc <[email protected]>
---
 net/mac80211/ieee80211_sta.c |    2 +-
 net/mac80211/sta_info.c      |    2 +-
 net/mac80211/sta_info.h      |    2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)
net/mac80211/ieee80211_sta.c +1 -1
index f9cf2f1..cfe6fcc 100644
@@ -3081,7 +3081,7 @@ static void ieee80211_sta_expire(struct net_device *dev, unsigned long exp_time)
 		if (time_after(jiffies, sta->last_rx + exp_time)) {
 			printk(KERN_DEBUG "%s: expiring inactive STA %s\n",
 			       dev->name, print_mac(mac, sta->addr));
-			sta_info_unlink(&sta);
+			__sta_info_unlink(&sta);
 			if (sta)
 				list_add(&sta->list, &tmp_list);
 		}
net/mac80211/sta_info.c +1 -1
index f708367..ba02b43 100644
@@ -409,7 +409,7 @@ static struct sta_info *__sta_info_unpin(struct sta_info *sta)
 	return ret;
 }
 
-static void __sta_info_unlink(struct sta_info **sta)
+void __sta_info_unlink(struct sta_info **sta)
 {
 	struct ieee80211_local *local = (*sta)->local;
 	struct ieee80211_sub_if_data *sdata = (*sta)->sdata;
net/mac80211/sta_info.h +2 -0
index 5e39a41..3a89b28 100644
@@ -347,6 +347,8 @@ int sta_info_insert(struct sta_info *sta);
  * has already unlinked it.
  */
 void sta_info_unlink(struct sta_info **sta);
+/* no lock version */
+void __sta_info_unlink(struct sta_info **sta);
 
 void sta_info_destroy(struct sta_info *sta);
 void sta_info_set_tim_bit(struct sta_info *sta);
Signature · 1 line
1.5.4.4
#2 lore raw
Quoted 4 lines · Jiri Slaby

Hi,

it's against -mm, what's current mac80211 git tree? It seems that -mm has fresher material, than wireless-2.6...

The current tree is wireless-testing

maintainer
#3 lore raw
In reply to Jiri Slaby
Quoted 4 lines

ieee80211_sta_expire grabs local->sta_lock and calls sta_info_unlink which tries to grab the lock again. (make available) and use __sta_info_unlink variant instead.

A patch equivalent to this should already be in.

johannes

#5 lore raw
In reply to Jiri Slaby
Quoted 4 lines · Jiri Slaby

Hi,

it's against -mm, what's current mac80211 git tree? It seems that -mm has fresher material, than wireless-2.6...

As it should. The wireless-2.6 tree is for feeding the linux-2.6 tree (by way of the net-2.6 tree). Similarly, wireless-2.6.26 feeds -mm by way of the net-2.6.26 tree.

Please use the wireless-testing tree for development, as it contains both sets of patches (fixes for the current release and updates for the future) as well as a few extras (like drivers still in development). Plus it is somewhat more stable, being based off the most a recent -rc release rather than just whatever someone last pulled.

Hth!

John

Signature · 2 lines
John W. Linville
[email protected]
author
#4 lore raw
In reply to Johannes Berg
Quoted 5 lines · Johannes Berg
Quoted 3 lines

ieee80211_sta_expire grabs local->sta_lock and calls sta_info_unlink which tries to grab the lock again. (make available) and use __sta_info_unlink variant instead.

A patch equivalent to this should already be in.

Yeah, it is. I already replied to myself after getting to know about wireless-testing, but forgot to click "send". Thanks.

author
#6 lore raw
In reply to John W. Linville
Quoted 9 lines · John W. Linville
Quoted 4 lines · Jiri Slaby

Hi,

it's against -mm, what's current mac80211 git tree? It seems that -mm has fresher material, than wireless-2.6...

As it should. The wireless-2.6 tree is for feeding the linux-2.6 tree (by way of the net-2.6 tree). Similarly, wireless-2.6.26 feeds -mm by way of the net-2.6.26 tree.

Wow, too many trees even with their branches to know the ropes.

Quoted 5 lines

Please use the wireless-testing tree for development, as it contains both sets of patches (fixes for the current release and updates for the future) as well as a few extras (like drivers still in development). Plus it is somewhat more stable, being based off the most a recent -rc release rather than just whatever someone last pulled.

Ok, thanks.

#7 lore raw
Quoted 4 lines · Jiri Slaby
Quoted 3 lines · John W. Linville
Quoted 2 lines · Jiri Slaby

Hi,

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

it's against -mm, what's current mac80211 git tree? It seems that -mm has fresher material, than wireless-2.6...

As it should. The wireless-2.6 tree is for feeding the linux-2.6 tree (by way of the net-2.6 tree). Similarly, wireless-2.6.26 feeds -mm by way of the net-2.6.26 tree.

Wow, too many trees even with their branches to know the ropes.

Pick your poison -- previously everyone complained about the number of branches in the tree.

FWIW, I've had far fewer complaints about tree management since switching to the new practices. Of course, most of that is probably attributable to pleasing dwmw2 (more-or-less)...

John

Signature · 2 lines
John W. Linville
[email protected]