Linux-WPAN Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] drivers: net: fix memory leak in atusb_probe
@ 2021-04-01  4:46 Pavel Skripkin
  2021-04-01 22:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Skripkin @ 2021-04-01  4:46 UTC (permalink / raw)
  To: stefan, alex.aring, davem, kuba
  Cc: linux-wpan, netdev, linux-kernel, Pavel Skripkin,
	syzbot+28a246747e0a465127f3

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>
---
 drivers/net/ieee802154/atusb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
index 0dd0ba915ab9..23ee0b14cbfa 100644
--- a/drivers/net/ieee802154/atusb.c
+++ b/drivers/net/ieee802154/atusb.c
@@ -365,6 +365,7 @@ static int atusb_alloc_urbs(struct atusb *atusb, int n)
 			return -ENOMEM;
 		}
 		usb_anchor_urb(urb, &atusb->idle_urbs);
+		usb_free_urb(urb);
 		n--;
 	}
 	return 0;
-- 
2.30.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers: net: fix memory leak in atusb_probe
  2021-04-01  4:46 [PATCH] drivers: net: fix memory leak in atusb_probe Pavel Skripkin
@ 2021-04-01 22:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-01 22:50 UTC (permalink / raw)
  To: Pavel Skripkin
  Cc: stefan, alex.aring, davem, kuba, linux-wpan, netdev,
	linux-kernel, syzbot+28a246747e0a465127f3

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Thu,  1 Apr 2021 07:46:24 +0300 you wrote:
> 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]
> 
> [...]

Here is the summary with links:
  - drivers: net: fix memory leak in atusb_probe
    https://git.kernel.org/netdev/net/c/6b9fbe169551

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01  4:46 [PATCH] drivers: net: fix memory leak in atusb_probe Pavel Skripkin
2021-04-01 22:50 ` patchwork-bot+netdevbpf

Linux-WPAN Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wpan/0 linux-wpan/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wpan linux-wpan/ https://lore.kernel.org/linux-wpan \
		linux-wpan@vger.kernel.org
	public-inbox-index linux-wpan

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wpan


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git