Skip to content
Snippets Groups Projects
Commit 395bf1f6 authored by Pavel Skripkin's avatar Pavel Skripkin Committed by Greg Kroah-Hartman
Browse files

drivers: net: fix memory leak in atusb_probe


commit 6b9fbe16 upstream.

syzbot reported memory leak in atusb_probe()[1].
The problem was in atusb_alloc_urbs().
Since urb is anchored, we need to release the reference
to correctly free the urb

backtrace:
    [<ffffffff82ba0466>] kmalloc include/linux/slab.h:559 [inline]
    [<ffffffff82ba0466>] usb_alloc_urb+0x66/0xe0 drivers/usb/core/urb.c:74
    [<ffffffff82ad3888>] atusb_alloc_urbs drivers/net/ieee802154/atusb.c:362 [inline][2]
    [<ffffffff82ad3888>] atusb_probe+0x158/0x820 drivers/net/ieee802154/atusb.c:1038 [1]

Reported-by: default avatar <syzbot+28a246747e0a465127f3@syzkaller.appspotmail.com>
Signed-off-by: default avatarPavel Skripkin <paskripkin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 361c17d1
No related branches found
No related tags found
No related merge requests found
...@@ -341,6 +341,7 @@ static int atusb_alloc_urbs(struct atusb *atusb, int n) ...@@ -341,6 +341,7 @@ static int atusb_alloc_urbs(struct atusb *atusb, int n)
return -ENOMEM; return -ENOMEM;
} }
usb_anchor_urb(urb, &atusb->idle_urbs); usb_anchor_urb(urb, &atusb->idle_urbs);
usb_free_urb(urb);
n--; n--;
} }
return 0; return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment