OSDN Git Service

drivers: net: fix memory leak in atusb_probe
authorPavel Skripkin <paskripkin@gmail.com>
Thu, 1 Apr 2021 04:46:24 +0000 (07:46 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Apr 2021 22:46:45 +0000 (15:46 -0700)
commit6b9fbe16955152626557ec6f439f3407b7769941
treed01ff885853bef08d04a10b8b12b8c51d28b8525
parent622d13694b5f048c01caa7ba548498d9880d4cb0
drivers: net: fix memory leak in atusb_probe

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: syzbot+28a246747e0a465127f3@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ieee802154/atusb.c