diff options
author | Daniel Mack <daniel@caiaq.de> | 2010-03-29 11:14:18 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-30 15:37:37 -0400 |
commit | 7371400431389e1df6a2a05ab9882055b8a6ff2c (patch) | |
tree | a14d9b7c6edc8bde06c0fd855bb81453e2872e28 /drivers | |
parent | 8e1a53c615e8efe0fac670f2973da64758748a8a (diff) |
net/wireless/libertas: do not call wiphy_unregister() w/o wiphy_register()
The libertas driver calls wiphy_unregister() without a prior
wiphy_register() when a devices fails initialization. Fix this by
introducing a private flag.
[ 9.310000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[...]
[ 9.330000] [<c0311310>] (wiphy_unregister+0xfc/0x19c) from [<bf00c9ec>] (lbs_cfg_free+0x70/0x9c [libertas])
[ 9.330000] [<bf00c9ec>] (lbs_cfg_free+0x70/0x9c [libertas]) from [<bf014fdc>] (lbs_remove_card+0x180/0x210 [libertas])
[ 9.330000] [<bf014fdc>] (lbs_remove_card+0x180/0x210 [libertas]) from [<bf035394>] (if_sdio_probe+0xdc4/0xef4 [libertas_sdio])
[ 9.330000] [<bf035394>] (if_sdio_probe+0xdc4/0xef4 [libertas_sdio]) from [<c0230d14>] (sdio_bus_probe+0xd4/0xf0)
[ 9.330000] [<c0230d14>] (sdio_bus_probe+0xd4/0xf0) from [<c01a6034>] (driver_probe_device+0xa4/0x174)
[ 9.330000] [<c01a6034>] (driver_probe_device+0xa4/0x174) from [<c01a6164>] (__driver_attach+0x60/0x84)
[ 9.330000] [<c01a6164>] (__driver_attach+0x60/0x84) from [<c01a5854>] (bus_for_each_dev+0x4c/0x8c)
[ 9.330000] [<c01a5854>] (bus_for_each_dev+0x4c/0x8c) from [<c01a50e4>] (bus_add_driver+0xa0/0x228)
[ 9.330000] [<c01a50e4>] (bus_add_driver+0xa0/0x228) from [<c01a6470>] (driver_register+0xc0/0x150)
[ 9.330000] [<c01a6470>] (driver_register+0xc0/0x150) from [<bf03a06c>] (if_sdio_init_module+0x6c/0x108 [libertas_sdio])
[ 9.330000] [<bf03a06c>] (if_sdio_init_module+0x6c/0x108 [libertas_sdio]) from [<c00263ac>] (do_one_initcall+0x5c/0x1bc)
[ 9.330000] [<c00263ac>] (do_one_initcall+0x5c/0x1bc) from [<c0069f80>] (sys_init_module+0xc0/0x1f0)
[ 9.330000] [<c0069f80>] (sys_init_module+0xc0/0x1f0) from [<c0026f00>] (ret_fast_syscall+0x0/0x30)
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Dan Williams <dcbw@redhat.com>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: Holger Schurig <hs4233@mail.mn-solutions.de>
Cc: Bing Zhao <bzhao@marvell.com>
Cc: libertas-dev@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/libertas/cfg.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/dev.h | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 4396dccd12ac..82ebe1461a77 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c | |||
@@ -172,6 +172,8 @@ int lbs_cfg_register(struct lbs_private *priv) | |||
172 | if (ret < 0) | 172 | if (ret < 0) |
173 | lbs_pr_err("cannot register wiphy device\n"); | 173 | lbs_pr_err("cannot register wiphy device\n"); |
174 | 174 | ||
175 | priv->wiphy_registered = true; | ||
176 | |||
175 | ret = register_netdev(priv->dev); | 177 | ret = register_netdev(priv->dev); |
176 | if (ret) | 178 | if (ret) |
177 | lbs_pr_err("cannot register network device\n"); | 179 | lbs_pr_err("cannot register network device\n"); |
@@ -190,9 +192,11 @@ void lbs_cfg_free(struct lbs_private *priv) | |||
190 | if (!wdev) | 192 | if (!wdev) |
191 | return; | 193 | return; |
192 | 194 | ||
193 | if (wdev->wiphy) { | 195 | if (priv->wiphy_registered) |
194 | wiphy_unregister(wdev->wiphy); | 196 | wiphy_unregister(wdev->wiphy); |
197 | |||
198 | if (wdev->wiphy) | ||
195 | wiphy_free(wdev->wiphy); | 199 | wiphy_free(wdev->wiphy); |
196 | } | 200 | |
197 | kfree(wdev); | 201 | kfree(wdev); |
198 | } | 202 | } |
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 6977ee820214..6875e1498bd5 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h | |||
@@ -36,6 +36,7 @@ struct lbs_private { | |||
36 | 36 | ||
37 | /* CFG80211 */ | 37 | /* CFG80211 */ |
38 | struct wireless_dev *wdev; | 38 | struct wireless_dev *wdev; |
39 | bool wiphy_registered; | ||
39 | 40 | ||
40 | /* Mesh */ | 41 | /* Mesh */ |
41 | struct net_device *mesh_dev; /* Virtual device */ | 42 | struct net_device *mesh_dev; /* Virtual device */ |