Skip to content

Commit

Permalink
at76c50x-usb: fix use after free on failure path in at76_probe()
Browse files Browse the repository at this point in the history
After commit 174beab ("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>
  • Loading branch information
Alexey Khoroshilov authored and John W. Linville committed Aug 25, 2014
1 parent e5cd6ce commit 29e20aa
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/wireless/at76c50x-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2423,8 +2423,6 @@ static void at76_delete_device(struct at76_priv *priv)

kfree_skb(priv->rx_skb);

usb_put_dev(priv->udev);

at76_dbg(DBG_PROC_ENTRY, "%s: before freeing priv/ieee80211_hw",
__func__);
ieee80211_free_hw(priv->hw);
Expand Down Expand Up @@ -2558,6 +2556,7 @@ static void at76_disconnect(struct usb_interface *interface)

wiphy_info(priv->hw->wiphy, "disconnecting\n");
at76_delete_device(priv);
usb_put_dev(priv->udev);
dev_info(&interface->dev, "disconnected\n");
}

Expand Down

0 comments on commit 29e20aa

Please sign in to comment.