d80211: Fix __ieee80211_if_del on live interfaces
Subsystems (2)
PATCH 1/1 d80211: Fix __ieee80211_if_del on live interfaces
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.
---
net/d80211/ieee80211.c | 2 ++ net/d80211/ieee80211_iface.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-)
net/d80211/ieee80211.c +2 -0
@@ -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; }
net/d80211/ieee80211_iface.c +0 -4
@@ -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);
Quoted 8 lines · Michael Wu
d80211: Fix
__ieee80211_if_delon live interfaces
ieee80211_if_reinitis called in__ieee80211_if_del, which clears the contents ofsdata->u. After that,unregister_netdeviceis called. If the interface is still up,unregister_netdevicewill end up callingdev->stop, anddev->stopexpects the contents ofsdata->uto be valid. Bad things typically happen at this point.
Quoted 8 lines
This patch fixes that by setting
dev->uninittoieee80211_if_reinitand eliminating the call toieee80211_if_reinitin__ieee80211_if_del. This allowsieee80211_if_reinitto be called at a safer time. It also allows the removal of the call toieee80211_if_shutdowninieee80211_if_reinitbecauseieee80211_if_reinitnow will never be called while the interface is up.Signed-off-by Michael Wu <[email protected]>
ACK, this fixes the lockup bug I recently reported.
Quoted 49 lines
---
net/d80211/ieee80211.c | 2 ++ net/d80211/ieee80211_iface.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-)net/d80211/ieee80211.c +2
-0@@ -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; }net/d80211/ieee80211_iface.c +0
-4@@ -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);
Signature · 1 line
Greetings Michael.
Jiri Benc
AppliedQuoted 6 lines · Michael Wu
This patch fixes that by setting
dev->uninittoieee80211_if_reinitand eliminating the call toieee80211_if_reinitin__ieee80211_if_del. This allowsieee80211_if_reinitto be called at a safer time. It also allows the removal of the call toieee80211_if_shutdowninieee80211_if_reinitbecauseieee80211_if_reinitnow 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
Signature · 2 lines
Jiri Benc SUSE Labs