Thread (1 message) 1 message, 1 author, 2020-08-21
STALE2193d

[PATCH AUTOSEL 4.14 20/30] rtlwifi: rtl8192cu: Prevent leaking urb

From: Sasha Levin <sashal@kernel.org>
Date: 2020-08-21 16:49:21
Also in: linux-wireless, lkml, stable
Subsystem: realtek wireless driver (rtlwifi family), the rest · Maintainers: Ping-Ke Shih, Linus Torvalds

From: Reto Schneider <redacted>

[ Upstream commit 03128643eb5453a798db5770952c73dc64fcaf00 ]

If usb_submit_urb fails the allocated urb should be unanchored and
released.

Signed-off-by: Reto Schneider <redacted>
Signed-off-by: Kalle Valo <redacted>
Link: https://lore.kernel.org/r/20200622132113.14508-3-code@reto-schneider.ch (local)
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/realtek/rtlwifi/usb.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c
index 7a050a75bdcbb..4fa4d877f913b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/usb.c
+++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
@@ -739,8 +739,11 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw)
 
 		usb_anchor_urb(urb, &rtlusb->rx_submitted);
 		err = usb_submit_urb(urb, GFP_KERNEL);
-		if (err)
+		if (err) {
+			usb_unanchor_urb(urb);
+			usb_free_urb(urb);
 			goto err_out;
+		}
 		usb_free_urb(urb);
 	}
 	return 0;
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help