All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3.9] mac80211: always synchronize_net() during station removal
@ 2013-03-06 22:19 Johannes Berg
  2013-03-07 10:22 ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2013-03-06 22:19 UTC (permalink / raw)
  To: linux-wireless; +Cc: emmanuel.grumbach, Johannes Berg

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

If there are keys left during station removal, then a
synchronize_net() will be done (for each key, I have a
patch to address this for 3.10), otherwise it won't be
done at all which causes issues because the station
could be used for TX while it's being removed from the
driver -- that might confuse the driver.

Fix this by always doing synchronize_net() if no key
was present any more.

Cc: stable@vger.kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/sta_info.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index a79ce82..238a0cc 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -766,6 +766,7 @@ int __must_check __sta_info_destroy(struct sta_info *sta)
 	struct ieee80211_local *local;
 	struct ieee80211_sub_if_data *sdata;
 	int ret, i;
+	bool have_key = false;
 
 	might_sleep();
 
@@ -793,12 +794,19 @@ int __must_check __sta_info_destroy(struct sta_info *sta)
 	list_del_rcu(&sta->list);
 
 	mutex_lock(&local->key_mtx);
-	for (i = 0; i < NUM_DEFAULT_KEYS; i++)
+	for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
 		__ieee80211_key_free(key_mtx_dereference(local, sta->gtk[i]));
-	if (sta->ptk)
+		have_key = true;
+	}
+	if (sta->ptk) {
 		__ieee80211_key_free(key_mtx_dereference(local, sta->ptk));
+		have_key = true;
+	}
 	mutex_unlock(&local->key_mtx);
 
+	if (!have_key)
+		synchronize_net();
+
 	sta->dead = true;
 
 	local->num_sta--;
-- 
1.8.0


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

* Re: [PATCH 3.9] mac80211: always synchronize_net() during station removal
  2013-03-06 22:19 [PATCH 3.9] mac80211: always synchronize_net() during station removal Johannes Berg
@ 2013-03-07 10:22 ` Johannes Berg
  2013-03-15 18:22   ` Luis R. Rodriguez
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2013-03-07 10:22 UTC (permalink / raw)
  To: linux-wireless; +Cc: emmanuel.grumbach

On Wed, 2013-03-06 at 23:19 +0100, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> If there are keys left during station removal, then a
> synchronize_net() will be done (for each key, I have a
> patch to address this for 3.10), otherwise it won't be
> done at all which causes issues because the station
> could be used for TX while it's being removed from the
> driver -- that might confuse the driver.
> 
> Fix this by always doing synchronize_net() if no key
> was present any more.

Applied.

johannes


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

* Re: [PATCH 3.9] mac80211: always synchronize_net() during station removal
  2013-03-07 10:22 ` Johannes Berg
@ 2013-03-15 18:22   ` Luis R. Rodriguez
  2013-03-18 19:03     ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Luis R. Rodriguez @ 2013-03-15 18:22 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, emmanuel.grumbach

On Thu, Mar 7, 2013 at 2:22 AM, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Wed, 2013-03-06 at 23:19 +0100, Johannes Berg wrote:
>> From: Johannes Berg <johannes.berg@intel.com>
>>
>> If there are keys left during station removal, then a
>> synchronize_net() will be done (for each key, I have a
>> patch to address this for 3.10), otherwise it won't be
>> done at all which causes issues because the station
>> could be used for TX while it's being removed from the
>> driver -- that might confuse the driver.
>>
>> Fix this by always doing synchronize_net() if no key
>> was present any more.
>
> Applied.

This applies to v3.8 as well, do you want it there too?

  LUis

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

* Re: [PATCH 3.9] mac80211: always synchronize_net() during station removal
  2013-03-15 18:22   ` Luis R. Rodriguez
@ 2013-03-18 19:03     ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2013-03-18 19:03 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-wireless, emmanuel.grumbach

On Fri, 2013-03-15 at 11:22 -0700, Luis R. Rodriguez wrote:
> On Thu, Mar 7, 2013 at 2:22 AM, Johannes Berg <johannes@sipsolutions.net> wrote:
> > On Wed, 2013-03-06 at 23:19 +0100, Johannes Berg wrote:
> >> From: Johannes Berg <johannes.berg@intel.com>
> >>
> >> If there are keys left during station removal, then a
> >> synchronize_net() will be done (for each key, I have a
> >> patch to address this for 3.10), otherwise it won't be
> >> done at all which causes issues because the station
> >> could be used for TX while it's being removed from the
> >> driver -- that might confuse the driver.
> >>
> >> Fix this by always doing synchronize_net() if no key
> >> was present any more.
> >
> > Applied.
> 
> This applies to v3.8 as well, do you want it there too?

Dunno, I don't know of a bug that was triggered by this, I only know our
new driver might trigger bugs without this.

johannes


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

end of thread, other threads:[~2013-03-18 19:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-06 22:19 [PATCH 3.9] mac80211: always synchronize_net() during station removal Johannes Berg
2013-03-07 10:22 ` Johannes Berg
2013-03-15 18:22   ` Luis R. Rodriguez
2013-03-18 19:03     ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.