netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] d80211: Fix __ieee80211_if_del on live interfaces
@ 2007-01-10  6:19 Michael Wu
  2007-01-10 20:09 ` Michael Buesch
  2007-01-10 20:16 ` Jiri Benc
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Wu @ 2007-01-10  6:19 UTC (permalink / raw)
  To: Jiri Benc; +Cc: John Linville, netdev, Ulrich Kunitz, Michael Buesch

[-- Attachment #1: Type: text/plain, Size: 2311 bytes --]

d80211: Fix __ieee80211_if_del on live interfaces

ieee80211_if_reinit is called in __ieee80211_if_del, which clears the
contents of sdata->u. After that, unregister_netdevice is called. If the
interface is still up, unregister_netdevice will end up calling dev->stop,
and dev->stop expects the contents of sdata->u to be valid. Bad things
typically happen at this point.

This patch fixes that by setting dev->uninit to ieee80211_if_reinit and
eliminating the call to ieee80211_if_reinit in __ieee80211_if_del. This
allows ieee80211_if_reinit to be called at a safer time. It also allows
the removal of the call to ieee80211_if_shutdown in ieee80211_if_reinit
because ieee80211_if_reinit now will never be called while the interface
is up.

Signed-off-by: Michael Wu <flamingice@sourmilk.net>
---

 net/d80211/ieee80211.c       |    2 ++
 net/d80211/ieee80211_iface.c |    4 ----
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 964fe45..2f1dce5 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -4324,6 +4324,7 @@ void ieee80211_if_setup(struct net_devic
 	dev->open = ieee80211_open;
 	dev->stop = ieee80211_stop;
 	dev->tx_queue_len = 0;
+	dev->uninit = ieee80211_if_reinit;
 	dev->destructor = ieee80211_if_free;
 }
 
@@ -4338,6 +4339,7 @@ void ieee80211_if_mgmt_setup(struct net_
 	dev->type = ARPHRD_IEEE80211_PRISM;
 	dev->hard_header_parse = header_parse_80211;
 	dev->tx_queue_len = 0;
+	dev->uninit = ieee80211_if_reinit;
 	dev->destructor = ieee80211_if_free;
 }
 
diff --git a/net/d80211/ieee80211_iface.c b/net/d80211/ieee80211_iface.c
index cac0dd5..3b2d259 100644
--- a/net/d80211/ieee80211_iface.c
+++ b/net/d80211/ieee80211_iface.c
@@ -234,9 +234,6 @@ void ieee80211_if_reinit(struct net_devi
 		sdata->keys[i] = NULL;
 	}
 
-	/* Shouldn't be necessary but won't hurt */
-	ieee80211_if_shutdown(dev);
-
 	switch (sdata->type) {
 	case IEEE80211_IF_TYPE_AP: {
 		/* Remove all virtual interfaces that use this BSS
@@ -311,7 +308,6 @@ void __ieee80211_if_del(struct ieee80211
 {
 	struct net_device *dev = sdata->dev;
 
-	ieee80211_if_reinit(dev);
 	list_del(&sdata->list);
 	ieee80211_sysfs_remove_netdevice(dev);
 	unregister_netdevice(dev);

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] d80211: Fix __ieee80211_if_del on live interfaces
  2007-01-10  6:19 [PATCH] d80211: Fix __ieee80211_if_del on live interfaces Michael Wu
@ 2007-01-10 20:09 ` Michael Buesch
  2007-01-10 20:16 ` Jiri Benc
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Buesch @ 2007-01-10 20:09 UTC (permalink / raw)
  To: Michael Wu; +Cc: John Linville, netdev, Ulrich Kunitz, Jiri Benc

On Wednesday 10 January 2007 07:19, Michael Wu wrote:
> d80211: Fix __ieee80211_if_del on live interfaces
> 
> ieee80211_if_reinit is called in __ieee80211_if_del, which clears the
> contents of sdata->u. After that, unregister_netdevice is called. If the
> interface is still up, unregister_netdevice will end up calling dev->stop,
> and dev->stop expects the contents of sdata->u to be valid. Bad things
> typically happen at this point.
> 
> This patch fixes that by setting dev->uninit to ieee80211_if_reinit and
> eliminating the call to ieee80211_if_reinit in __ieee80211_if_del. This
> allows ieee80211_if_reinit to be called at a safer time. It also allows
> the removal of the call to ieee80211_if_shutdown in ieee80211_if_reinit
> because ieee80211_if_reinit now will never be called while the interface
> is up.
> 
> Signed-off-by: Michael Wu <flamingice@sourmilk.net>

ACK, this fixes the lockup bug I recently reported.

> ---
> 
>  net/d80211/ieee80211.c       |    2 ++
>  net/d80211/ieee80211_iface.c |    4 ----
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
> index 964fe45..2f1dce5 100644
> --- a/net/d80211/ieee80211.c
> +++ b/net/d80211/ieee80211.c
> @@ -4324,6 +4324,7 @@ void ieee80211_if_setup(struct net_devic
>  	dev->open = ieee80211_open;
>  	dev->stop = ieee80211_stop;
>  	dev->tx_queue_len = 0;
> +	dev->uninit = ieee80211_if_reinit;
>  	dev->destructor = ieee80211_if_free;
>  }
>  
> @@ -4338,6 +4339,7 @@ void ieee80211_if_mgmt_setup(struct net_
>  	dev->type = ARPHRD_IEEE80211_PRISM;
>  	dev->hard_header_parse = header_parse_80211;
>  	dev->tx_queue_len = 0;
> +	dev->uninit = ieee80211_if_reinit;
>  	dev->destructor = ieee80211_if_free;
>  }
>  
> diff --git a/net/d80211/ieee80211_iface.c b/net/d80211/ieee80211_iface.c
> index cac0dd5..3b2d259 100644
> --- a/net/d80211/ieee80211_iface.c
> +++ b/net/d80211/ieee80211_iface.c
> @@ -234,9 +234,6 @@ void ieee80211_if_reinit(struct net_devi
>  		sdata->keys[i] = NULL;
>  	}
>  
> -	/* Shouldn't be necessary but won't hurt */
> -	ieee80211_if_shutdown(dev);
> -
>  	switch (sdata->type) {
>  	case IEEE80211_IF_TYPE_AP: {
>  		/* Remove all virtual interfaces that use this BSS
> @@ -311,7 +308,6 @@ void __ieee80211_if_del(struct ieee80211
>  {
>  	struct net_device *dev = sdata->dev;
>  
> -	ieee80211_if_reinit(dev);
>  	list_del(&sdata->list);
>  	ieee80211_sysfs_remove_netdevice(dev);
>  	unregister_netdevice(dev);
> 

-- 
Greetings Michael.

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

* Re: [PATCH] d80211: Fix __ieee80211_if_del on live interfaces
  2007-01-10  6:19 [PATCH] d80211: Fix __ieee80211_if_del on live interfaces Michael Wu
  2007-01-10 20:09 ` Michael Buesch
@ 2007-01-10 20:16 ` Jiri Benc
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Benc @ 2007-01-10 20:16 UTC (permalink / raw)
  To: Michael Wu; +Cc: John Linville, netdev, Ulrich Kunitz, Michael Buesch

On Wed, 10 Jan 2007 01:19:14 -0500, Michael Wu wrote:
> This patch fixes that by setting dev->uninit to ieee80211_if_reinit and
> eliminating the call to ieee80211_if_reinit in __ieee80211_if_del. This
> allows ieee80211_if_reinit to be called at a safer time. It also allows
> the removal of the call to ieee80211_if_shutdown in ieee80211_if_reinit
> because ieee80211_if_reinit now will never be called while the interface
> is up.

Applied to my tree, thanks for the patch. (And I can confirm it fixes
the problem reported by Michael Buesch too.)

 Jiri

-- 
Jiri Benc
SUSE Labs

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

end of thread, other threads:[~2007-01-10 20:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-10  6:19 [PATCH] d80211: Fix __ieee80211_if_del on live interfaces Michael Wu
2007-01-10 20:09 ` Michael Buesch
2007-01-10 20:16 ` Jiri Benc

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).