diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2014-08-14 19:00:06 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-08-25 15:39:23 -0400 |
commit | 29e20aa6c6aff35c81d4da2e2cd516dadb569061 (patch) | |
tree | 622e9576448d921bca82e4ad7f275df647be0750 /drivers/net/wireless/at76c50x-usb.c | |
parent | e5cd6cee46764467e6cb14841ff59cd2e2573502 (diff) |
at76c50x-usb: fix use after free on failure path in at76_probe()
After commit 174beab7d445 ("at76c50x-usb: Don't perform DMA from stack memory")
at76_delete_device() and usb_put_dev() are called both
if at76_init_new_device() fails in at76_probe().
But at76_delete_device() does usb_put_dev(priv->dev) itself
that means double usb_put_dev().
The patch avoids the problem by moving usb_put_dev() from
at76_delete_device() to at76_disconnect().
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/at76c50x-usb.c')
-rw-r--r-- | drivers/net/wireless/at76c50x-usb.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c index 334c2ece855a..da92bfa76b7c 100644 --- a/drivers/net/wireless/at76c50x-usb.c +++ b/drivers/net/wireless/at76c50x-usb.c | |||
@@ -2423,8 +2423,6 @@ static void at76_delete_device(struct at76_priv *priv) | |||
2423 | 2423 | ||
2424 | kfree_skb(priv->rx_skb); | 2424 | kfree_skb(priv->rx_skb); |
2425 | 2425 | ||
2426 | usb_put_dev(priv->udev); | ||
2427 | |||
2428 | at76_dbg(DBG_PROC_ENTRY, "%s: before freeing priv/ieee80211_hw", | 2426 | at76_dbg(DBG_PROC_ENTRY, "%s: before freeing priv/ieee80211_hw", |
2429 | __func__); | 2427 | __func__); |
2430 | ieee80211_free_hw(priv->hw); | 2428 | ieee80211_free_hw(priv->hw); |
@@ -2558,6 +2556,7 @@ static void at76_disconnect(struct usb_interface *interface) | |||
2558 | 2556 | ||
2559 | wiphy_info(priv->hw->wiphy, "disconnecting\n"); | 2557 | wiphy_info(priv->hw->wiphy, "disconnecting\n"); |
2560 | at76_delete_device(priv); | 2558 | at76_delete_device(priv); |
2559 | usb_put_dev(priv->udev); | ||
2561 | dev_info(&interface->dev, "disconnected\n"); | 2560 | dev_info(&interface->dev, "disconnected\n"); |
2562 | } | 2561 | } |
2563 | 2562 | ||