summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdun Nihaal <abdun.nihaal@gmail.com>2025-03-30 16:01:10 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-25 10:47:37 +0200
commita9682bfef2cf3802515a902e964d774e137be1b9 (patch)
tree031f568e1ae48ca02a840f92191b5b769c2f8227
parent1773fbf7c05b5cc7816506bff753ca895039f8c5 (diff)
wifi: at76c50x: fix use after free access in at76_disconnect
[ Upstream commit 27c7e63b3cb1a20bb78ed4a36c561ea4579fd7da ] The memory pointed to by priv is freed at the end of at76_delete_device function (using ieee80211_free_hw). But the code then accesses the udev field of the freed object to put the USB device. This may also lead to a memory leak of the usb device. Fix this by using udev from interface. Fixes: 29e20aa6c6af ("at76c50x-usb: fix use after free on failure path in at76_probe()") Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com> Link: https://patch.msgid.link/20250330103110.44080-1-abdun.nihaal@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/net/wireless/atmel/at76c50x-usb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c
index 504e05ea30f2..97ea7ab0f491 100644
--- a/drivers/net/wireless/atmel/at76c50x-usb.c
+++ b/drivers/net/wireless/atmel/at76c50x-usb.c
@@ -2552,7 +2552,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);
+ usb_put_dev(interface_to_usbdev(interface));
dev_info(&interface->dev, "disconnected\n");
}