public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: syzbot <syzbot+e8cb6691a7cf68256cb8@syzkaller.appspotmail.com>,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [usb?] memory leak in es58x_open
Date: Mon, 12 Jan 2026 16:06:15 +0100	[thread overview]
Message-ID: <04184aa1-0a74-4247-b618-0390108558cc@suse.com> (raw)
In-Reply-To: <6948d6c3.a70a0220.25eec0.0084.GAE@google.com>

[-- Attachment #1: Type: text/plain, Size: 6581 bytes --]

#syz test: upstream ea1013c15392

On 22.12.25 06:27, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    ea1013c15392 Merge tag 'bpf-fixes' of git://git.kernel.org..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1607bdc2580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=d60836e327fd6756
> dashboard link: https://syzkaller.appspot.com/bug?extid=e8cb6691a7cf68256cb8
> compiler:       gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=131add92580000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/5ee91238d53c/disk-ea1013c1.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/b8eb70b8203f/vmlinux-ea1013c1.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/3aed81c1b1c5/bzImage-ea1013c1.xz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+e8cb6691a7cf68256cb8@syzkaller.appspotmail.com
> 
> BUG: memory leak
> unreferenced object 0xffff88812623e000 (size 512):
>    comm "dhcpcd", pid 5478, jiffies 4294946142
>    hex dump (first 32 bytes):
>      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>    backtrace (crc 0):
>      kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
>      slab_post_alloc_hook mm/slub.c:4958 [inline]
>      slab_alloc_node mm/slub.c:5263 [inline]
>      __do_kmalloc_node mm/slub.c:5656 [inline]
>      __kmalloc_noprof+0x3e0/0x660 mm/slub.c:5669
>      kmalloc_noprof include/linux/slab.h:961 [inline]
>      hcd_buffer_alloc+0x151/0x190 drivers/usb/core/buffer.c:134
>      usb_alloc_coherent+0x44/0x70 drivers/usb/core/usb.c:1010
>      es58x_alloc_urb+0x4c/0xc0 drivers/net/can/usb/etas_es58x/es58x_core.c:1553
>      es58x_alloc_rx_urbs drivers/net/can/usb/etas_es58x/es58x_core.c:1711 [inline]
>      es58x_open+0x1b3/0x470 drivers/net/can/usb/etas_es58x/es58x_core.c:1785
>      __dev_open+0x1be/0x3c0 net/core/dev.c:1683
>      __dev_change_flags+0x30c/0x380 net/core/dev.c:9734
>      netif_change_flags+0x35/0x90 net/core/dev.c:9797
>      dev_change_flags+0x64/0xf0 net/core/dev_api.c:68
>      devinet_ioctl+0x5bf/0xd30 net/ipv4/devinet.c:1199
>      inet_ioctl+0x27c/0x2b0 net/ipv4/af_inet.c:1009
>      sock_do_ioctl+0x84/0x1a0 net/socket.c:1254
>      sock_ioctl+0x149/0x480 net/socket.c:1375
>      vfs_ioctl fs/ioctl.c:51 [inline]
>      __do_sys_ioctl fs/ioctl.c:597 [inline]
>      __se_sys_ioctl fs/ioctl.c:583 [inline]
>      __x64_sys_ioctl+0xf4/0x140 fs/ioctl.c:583
>      do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
>      do_syscall_64+0xa4/0xf80 arch/x86/entry/syscall_64.c:94
>      entry_SYSCALL_64_after_hwframe+0x77/0x7f
> 
> BUG: memory leak
> unreferenced object 0xffff888126112200 (size 512):
>    comm "dhcpcd", pid 5478, jiffies 4294946373
>    hex dump (first 32 bytes):
>      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>    backtrace (crc 0):
>      kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
>      slab_post_alloc_hook mm/slub.c:4958 [inline]
>      slab_alloc_node mm/slub.c:5263 [inline]
>      __do_kmalloc_node mm/slub.c:5656 [inline]
>      __kmalloc_noprof+0x3e0/0x660 mm/slub.c:5669
>      kmalloc_noprof include/linux/slab.h:961 [inline]
>      hcd_buffer_alloc+0x151/0x190 drivers/usb/core/buffer.c:134
>      usb_alloc_coherent+0x44/0x70 drivers/usb/core/usb.c:1010
>      es58x_alloc_urb+0x4c/0xc0 drivers/net/can/usb/etas_es58x/es58x_core.c:1553
>      es58x_alloc_rx_urbs drivers/net/can/usb/etas_es58x/es58x_core.c:1711 [inline]
>      es58x_open+0x1b3/0x470 drivers/net/can/usb/etas_es58x/es58x_core.c:1785
>      __dev_open+0x1be/0x3c0 net/core/dev.c:1683
>      __dev_change_flags+0x30c/0x380 net/core/dev.c:9734
>      netif_change_flags+0x35/0x90 net/core/dev.c:9797
>      dev_change_flags+0x64/0xf0 net/core/dev_api.c:68
>      devinet_ioctl+0x5bf/0xd30 net/ipv4/devinet.c:1199
>      inet_ioctl+0x27c/0x2b0 net/ipv4/af_inet.c:1009
>      sock_do_ioctl+0x84/0x1a0 net/socket.c:1254
>      sock_ioctl+0x149/0x480 net/socket.c:1375
>      vfs_ioctl fs/ioctl.c:51 [inline]
>      __do_sys_ioctl fs/ioctl.c:597 [inline]
>      __se_sys_ioctl fs/ioctl.c:583 [inline]
>      __x64_sys_ioctl+0xf4/0x140 fs/ioctl.c:583
>      do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
>      do_syscall_64+0xa4/0xf80 arch/x86/entry/syscall_64.c:94
>      entry_SYSCALL_64_after_hwframe+0x77/0x7f
> 
> BUG: memory leak
> unreferenced object 0xffff888126188800 (size 512):
>    comm "dhcpcd", pid 5478, jiffies 4294946404
>    hex dump (first 32 bytes):
>      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>    backtrace (crc 0):
>      kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
>      slab_post_alloc_hook mm/slub.c:4958 [inline]
>      slab_alloc_node mm/slub.c:5263 [inline]
>      __do_kmalloc_node mm/slub.c:5656 [inline]
>      __kmalloc_noprof+0x3e0/0x660 mm/slub.c:5669
>      kmalloc_noprof include/linux/slab.h:961 [inline]
>      hcd_buffer_alloc+0x151/0x190 drivers/usb/core/buffer.c:134
>      usb_alloc_coherent+0x44/0x70 drivers/usb/core/usb.c:1010
>      es58x_alloc_urb+0x4c/0xc0 drivers/net/can/usb/etas_es58x/es58x_core.c:1553
>      es58x_alloc_rx_urbs drivers/net/can/usb/etas_es58x/es58x_core.c:1711 [inline]
>      es58x_open+0x1b3/0x470 drivers/net/can/usb/etas_es58x/es58x_core.c:1785
>      __dev_open+0x1be/0x3c0 net/core/dev.c:1683
>      __dev_change_flags+0x30c/0x380 net/core/dev.c:9734
>      netif_change_flags+0x35/0x90 net/core/dev.c:9797
>      dev_change_flags+0x64/0xf0 net/core/dev_api.c:68
>      devinet_ioctl+0x5bf/0xd30 net/ipv4/devinet.c:1199
>      inet_ioctl+0x27c/0x2b0 net/ipv4/af_inet.c:1009
>      sock_do_ioctl+0x84/0x1a0 net/socket.c:1254
>      sock_ioctl+0x149/0x480 net/socket.c:1375
>      vfs_ioctl fs/ioctl.c:51 [inline]
>      __do_sys_ioctl fs/ioctl.c:597 [inline]
>      __se_sys_ioctl fs/ioctl.c:583 [inline]
>      __x64_sys_ioctl+0xf4/0x140 fs/ioctl.c:583
>      do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
>      do_syscall_64+0xa4/0xf80 arch/x86/entry/syscall_64.c:94
>      entry_SYSCALL_64_after_hwframe+0x77/0x7f
> 
> connection error: failed to recv *flatrpc.ExecutorMessageRawT: EOF

[-- Attachment #2: 0001-net-can-etas_es58x-full-cleanup-in-the-error-case.patch --]
[-- Type: text/x-patch, Size: 1015 bytes --]

From 2c7239b8c86df91fad816365f5ae79806726780f Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum@suse.com>
Date: Mon, 12 Jan 2026 16:01:39 +0100
Subject: [PATCH] net: can: etas_es58x: full cleanup in the error case

Memory allocation can fail in the middle. Hence the cleanup
needs to be called in every case.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/net/can/usb/etas_es58x/es58x_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
index f799233c2b72..8a8764374713 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
@@ -1783,8 +1783,9 @@ static int es58x_open(struct net_device *netdev)
 
 	if (!es58x_dev->opened_channel_cnt) {
 		ret = es58x_alloc_rx_urbs(es58x_dev);
+		/* can fail partially */
 		if (ret)
-			return ret;
+			goto free_urbs;
 
 		ret = es58x_set_realtime_diff_ns(es58x_dev);
 		if (ret)
-- 
2.52.0


  reply	other threads:[~2026-01-12 15:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-22  5:27 [syzbot] [usb?] memory leak in es58x_open syzbot
2026-01-12 15:06 ` Oliver Neukum [this message]
2026-01-12 15:41   ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=04184aa1-0a74-4247-b618-0390108558cc@suse.com \
    --to=oneukum@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=syzbot+e8cb6691a7cf68256cb8@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox