Commit e6c5fc53d0f44a772398402ee8a1879818e42b4e
Committed by
John W. Linville
1 parent
63ca2d74ea
Exists in
master
and in
39 other branches
ipw2200: fix oops on missing firmware
For non-monitor interfaces, the syntax for alloc_ieee80211/free_80211 is wrong. Because alloc_ieee80211 only creates (wiphy_new) a wiphy, but free_80211() does wiphy_unregister() also. This is only correct when the later wiphy_register() is called successfully, which apparently is not the case for your fw doesn't exist one. Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Showing 4 changed files with 16 additions and 6 deletions Side-by-side Diff
drivers/net/wireless/ipw2x00/ipw2100.c
... | ... | @@ -6325,8 +6325,10 @@ |
6325 | 6325 | |
6326 | 6326 | fail: |
6327 | 6327 | if (dev) { |
6328 | - if (registered) | |
6328 | + if (registered) { | |
6329 | + unregister_ieee80211(priv->ieee); | |
6329 | 6330 | unregister_netdev(dev); |
6331 | + } | |
6330 | 6332 | |
6331 | 6333 | ipw2100_hw_stop_adapter(priv); |
6332 | 6334 | |
... | ... | @@ -6383,6 +6385,7 @@ |
6383 | 6385 | /* Unregister the device first - this results in close() |
6384 | 6386 | * being called if the device is open. If we free storage |
6385 | 6387 | * first, then close() will crash. */ |
6388 | + unregister_ieee80211(priv->ieee); | |
6386 | 6389 | unregister_netdev(dev); |
6387 | 6390 | |
6388 | 6391 | /* ipw2100_down will ensure that there is no more pending work |
drivers/net/wireless/ipw2x00/ipw2200.c
... | ... | @@ -11821,6 +11821,7 @@ |
11821 | 11821 | if (err) { |
11822 | 11822 | IPW_ERROR("Failed to register promiscuous network " |
11823 | 11823 | "device (error %d).\n", err); |
11824 | + unregister_ieee80211(priv->ieee); | |
11824 | 11825 | unregister_netdev(priv->net_dev); |
11825 | 11826 | goto out_remove_sysfs; |
11826 | 11827 | } |
... | ... | @@ -11871,6 +11872,7 @@ |
11871 | 11872 | |
11872 | 11873 | mutex_unlock(&priv->mutex); |
11873 | 11874 | |
11875 | + unregister_ieee80211(priv->ieee); | |
11874 | 11876 | unregister_netdev(priv->net_dev); |
11875 | 11877 | |
11876 | 11878 | if (priv->rxq) { |
drivers/net/wireless/ipw2x00/libipw.h
... | ... | @@ -1020,6 +1020,7 @@ |
1020 | 1020 | /* ieee80211.c */ |
1021 | 1021 | extern void free_ieee80211(struct net_device *dev, int monitor); |
1022 | 1022 | extern struct net_device *alloc_ieee80211(int sizeof_priv, int monitor); |
1023 | +extern void unregister_ieee80211(struct libipw_device *ieee); | |
1023 | 1024 | extern int libipw_change_mtu(struct net_device *dev, int new_mtu); |
1024 | 1025 | |
1025 | 1026 | extern void libipw_networks_age(struct libipw_device *ieee, |
drivers/net/wireless/ipw2x00/libipw_module.c
... | ... | @@ -235,16 +235,19 @@ |
235 | 235 | libipw_networks_free(ieee); |
236 | 236 | |
237 | 237 | /* free cfg80211 resources */ |
238 | - if (!monitor) { | |
239 | - wiphy_unregister(ieee->wdev.wiphy); | |
240 | - kfree(ieee->a_band.channels); | |
241 | - kfree(ieee->bg_band.channels); | |
238 | + if (!monitor) | |
242 | 239 | wiphy_free(ieee->wdev.wiphy); |
243 | - } | |
244 | 240 | |
245 | 241 | free_netdev(dev); |
246 | 242 | } |
247 | 243 | |
244 | +void unregister_ieee80211(struct libipw_device *ieee) | |
245 | +{ | |
246 | + wiphy_unregister(ieee->wdev.wiphy); | |
247 | + kfree(ieee->a_band.channels); | |
248 | + kfree(ieee->bg_band.channels); | |
249 | +} | |
250 | + | |
248 | 251 | #ifdef CONFIG_LIBIPW_DEBUG |
249 | 252 | |
250 | 253 | static int debug = 0; |
... | ... | @@ -330,4 +333,5 @@ |
330 | 333 | |
331 | 334 | EXPORT_SYMBOL(alloc_ieee80211); |
332 | 335 | EXPORT_SYMBOL(free_ieee80211); |
336 | +EXPORT_SYMBOL(unregister_ieee80211); |