rtl8xxxu: prevent leaking urb
diff mbox series

Message ID 20190920030043.30137-1-navid.emamdoost@gmail.com
State Accepted
Commit a2cdd07488e666aa93a49a3fc9c9b1299e27ef3c
Delegated to: Kalle Valo
Headers show
Series
  • rtl8xxxu: prevent leaking urb
Related show

Commit Message

Navid Emamdoost Sept. 20, 2019, 3 a.m. UTC
In rtl8xxxu_submit_int_urb if usb_submit_urb fails the allocated urb
should be released.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Chris Chiu Sept. 20, 2019, 10:23 a.m. UTC | #1
On Fri, Sep 20, 2019 at 11:01 AM Navid Emamdoost
<navid.emamdoost@gmail.com> wrote:
>
> In rtl8xxxu_submit_int_urb if usb_submit_urb fails the allocated urb
> should be released.
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>


> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> @@ -5443,6 +5443,7 @@ static int rtl8xxxu_submit_int_urb(struct ieee80211_hw *hw)
>         ret = usb_submit_urb(urb, GFP_KERNEL);
>         if (ret) {
>                 usb_unanchor_urb(urb);
> +               usb_free_urb(urb);
>                 goto error;
>         }
You're right. There's a usb_alloc_urb in the beginning of this
function and should be
handled after submit failure.

Chris
Kalle Valo Oct. 2, 2019, 4:32 a.m. UTC | #2
Navid Emamdoost <navid.emamdoost@gmail.com> wrote:

> In rtl8xxxu_submit_int_urb if usb_submit_urb fails the allocated urb
> should be released.
> 
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> Reviewed-by: Chris Chiu <chiu@endlessm.com>

Patch applied to wireless-drivers-next.git, thanks.

a2cdd07488e6 rtl8xxxu: prevent leaking urb

Patch
diff mbox series

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 8136e268b4e6..4a559c37e208 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -5443,6 +5443,7 @@  static int rtl8xxxu_submit_int_urb(struct ieee80211_hw *hw)
 	ret = usb_submit_urb(urb, GFP_KERNEL);
 	if (ret) {
 		usb_unanchor_urb(urb);
+		usb_free_urb(urb);
 		goto error;
 	}