]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
wifi: rtw88: fix device leak on probe failure
authorJohan Hovold <johan@kernel.org>
Fri, 6 Mar 2026 08:51:44 +0000 (09:51 +0100)
committerPing-Ke Shih <pkshih@realtek.com>
Mon, 16 Mar 2026 06:00:10 +0000 (14:00 +0800)
commitbbb15e71156cd9f5e1869eee7207a06ea8e96c39
treef7248f7d94651b5dde7d91f91871f73fe1ab0c2f
parent711b8add39294393a086b5c0e51f0c8d79a89f4d
wifi: rtw88: fix device leak on probe failure

Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

This driver takes a reference to the USB device during probe but does
not to release it on all probe errors (e.g. when descriptor parsing
fails).

Drop the redundant device reference to fix the leak, reduce cargo
culting, make it easier to spot drivers where an extra reference is
needed, and reduce the risk of further memory leaks.

Fixes: a82dfd33d123 ("wifi: rtw88: Add common USB chip support")
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/netdev/2026022319-turbofan-darkened-206d@gregkh/
Cc: stable@vger.kernel.org # 6.2
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260306085144.12064-19-johan@kernel.org
drivers/net/wireless/realtek/rtw88/usb.c