public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] wifi: rtw88: properly drop usb interface reference on error
@ 2026-02-23 11:37 Greg Kroah-Hartman
  2026-02-24  0:46 ` Ping-Ke Shih
  2026-03-03  3:07 ` Ping-Ke Shih
  0 siblings, 2 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2026-02-23 11:37 UTC (permalink / raw)
  To: linux-wireless; +Cc: linux-kernel, Greg Kroah-Hartman, Ping-Ke Shih, stable

If an error happens in the usb probe path, in rtw_usb_intf_init(), the
usb interface reference needs to be properly dropped, otherwise is is
incorrectly increased when returning to the USB core.

Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: stable <stable@kernel.org>
Assisted-by: gkh_clanker_2000
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/wireless/realtek/rtw88/usb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c
index 433b06c8d8a6..36ac20039ce2 100644
--- a/drivers/net/wireless/realtek/rtw88/usb.c
+++ b/drivers/net/wireless/realtek/rtw88/usb.c
@@ -1046,13 +1046,17 @@ static int rtw_usb_intf_init(struct rtw_dev *rtwdev,
 
 	rtwusb->udev = udev;
 	ret = rtw_usb_parse(rtwdev, intf);
-	if (ret)
+	if (ret) {
+		usb_put_dev(udev);
 		return ret;
+	}
 
 	rtwusb->usb_data = kcalloc(RTW_USB_MAX_RXTX_COUNT, sizeof(u32),
 				   GFP_KERNEL);
-	if (!rtwusb->usb_data)
+	if (!rtwusb->usb_data) {
+		usb_put_dev(udev);
 		return -ENOMEM;
+	}
 
 	usb_set_intfdata(intf, rtwdev->hw);
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-09  0:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 11:37 [PATCH net] wifi: rtw88: properly drop usb interface reference on error Greg Kroah-Hartman
2026-02-24  0:46 ` Ping-Ke Shih
2026-02-24  1:09   ` Greg Kroah-Hartman
2026-02-24  1:49     ` Ping-Ke Shih
2026-02-24  6:18       ` Greg Kroah-Hartman
2026-03-03  3:07 ` Ping-Ke Shih
2026-03-09  0:43   ` Ping-Ke Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox