]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
rtlwifi: rtl8192cu: Prevent leaking urb
authorReto Schneider <code@reto-schneider.ch>
Mon, 22 Jun 2020 13:21:12 +0000 (15:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:26:45 +0000 (11:26 +0200)
[ Upstream commit 03128643eb5453a798db5770952c73dc64fcaf00 ]

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

Signed-off-by: Reto Schneider <code@reto-schneider.ch>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200622132113.14508-3-code@reto-schneider.ch
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/realtek/rtlwifi/usb.c

index c66c6dc003783a6417c6d3a97553527e553e7d6e..bad06939a247c7bbd844baf57ac1647c9980dcf1 100644 (file)
@@ -718,8 +718,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;