Skip to content

Commit 29e20aa

Browse files
khoroshilovlinvjw
authored andcommitted
at76c50x-usb: fix use after free on failure path in at76_probe()
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 <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent e5cd6ce commit 29e20aa

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/net/wireless/at76c50x-usb.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,8 +2423,6 @@ static void at76_delete_device(struct at76_priv *priv)
24232423

24242424
kfree_skb(priv->rx_skb);
24252425

2426-
usb_put_dev(priv->udev);
2427-
24282426
at76_dbg(DBG_PROC_ENTRY, "%s: before freeing priv/ieee80211_hw",
24292427
__func__);
24302428
ieee80211_free_hw(priv->hw);
@@ -2558,6 +2556,7 @@ static void at76_disconnect(struct usb_interface *interface)
25582556

25592557
wiphy_info(priv->hw->wiphy, "disconnecting\n");
25602558
at76_delete_device(priv);
2559+
usb_put_dev(priv->udev);
25612560
dev_info(&interface->dev, "disconnected\n");
25622561
}
25632562

0 commit comments

Comments
 (0)