Skip to content

Commit

Permalink
wifi: at76c50x: fix use after free access in at76_disconnect
Browse files Browse the repository at this point in the history
[ Upstream commit 27c7e63 ]

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: 29e20aa ("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>
  • Loading branch information
Abdun Nihaal authored and Greg Kroah-Hartman committed Apr 25, 2025
1 parent a70ea92 commit 7ca5136
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/wireless/atmel/at76c50x-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2554,7 +2554,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");
}

Expand Down

0 comments on commit 7ca5136

Please sign in to comment.