memory leak in rtl8150_set_multicast
Subsystems (5)
syzbot
syzbotHello,
syzbot found the following issue on:
HEAD commit: d358e5254674 Merge tag 'for-6.19/dm-changes' of git://git... git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=11e431c2580000 kernel config: https://syzkaller.appspot.com/x/.config?x=9a0268003e02068d dashboard link: https://syzkaller.appspot.com/bug?extid=8dd915c7cb0490fc8c52 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=12dd661a580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/e79f317bb571/disk-d358e525.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/cf9e2849af10/vmlinux-d358e525.xz
kernel image: https://storage.googleapis.com/syzbot-assets/73d80a967038/bzImage-d358e525.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
BUG: memory leak
unreferenced object 0xffff888127d51010 (size 16):
comm "dhcpcd", pid 5479, jiffies 4294951443
hex dump (first 16 bytes):
40 05 30 01 00 00 02 00 9e 00 00 00 00 00 00 00 @.0.............
backtrace (crc 5546a3be):
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]
__kmalloc_cache_noprof+0x3b2/0x570 mm/slub.c:5771
kmalloc_noprof include/linux/slab.h:957 [inline]
async_set_registers drivers/net/usb/rtl8150.c:192 [inline]
rtl8150_set_multicast+0x7a/0x1c0 drivers/net/usb/rtl8150.c:679
__dev_set_rx_mode+0xc5/0x120 net/core/dev.c:9655
dev_set_rx_mode net/core/dev.c:9661 [inline]
__dev_open+0x23f/0x3c0 net/core/dev.c:1691
__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 0xffff8881282bae40 (size 192):
comm "dhcpcd", pid 5479, jiffies 4294951443
hex dump (first 32 bytes):
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 58 ae 2b 28 81 88 ff ff ........X.+(....
backtrace (crc d110b1b3):
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]
usb_alloc_urb+0x66/0xa0 drivers/usb/core/urb.c:75
async_set_registers drivers/net/usb/rtl8150.c:195 [inline]
rtl8150_set_multicast+0x97/0x1c0 drivers/net/usb/rtl8150.c:679
__dev_set_rx_mode+0xc5/0x120 net/core/dev.c:9655
dev_set_rx_mode net/core/dev.c:9661 [inline]
__dev_open+0x23f/0x3c0 net/core/dev.c:1691
__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/0x7fconnection error: failed to recv *flatrpc.ExecutorMessageRawT: EOF
---
This report is generated by a bot. It may contain errors. See https://goo.gl/tpsmEJ for more information about syzbot. syzbot engineers can be reached at [email protected].
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
async_set_registers() does not free the urb and req on the usb_submit_urb() call fail path. Fix by freeing both objects.
--- drivers/net/usb/rtl8150.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/usb/rtl8150.c +0 -0
@@ -211,6 +211,8 @@ static int async_set_registers(rtl8150_t *dev, u16
indx, u16 size, u16 reg)
if (res == -ENODEV)
netif_device_detach(dev->netdev);
dev_err(&dev->udev->dev, "%s failed with %d\n", __func__, res);
+ usb_free_urb(async_urb);
+ kfree(req);
}
return res; }
--
2.25.1
syzbot
syzbotForwarded: Re: [syzbot] [net?] [usb?] memory leak in rtl8150_set_multicast
In reply to syzbotFor archival purposes, forwarding an incoming command email to [email protected], [email protected].
For archival purposes, forwarding an incoming command email to [email protected], [email protected].
***
Subject: Re: [syzbot] [net?] [usb?] memory leak in rtl8150_set_multicast
Author: [email protected]
#syz test
async_set_registers() does not free the urb and req on the usb_submit_urb() call fail path. Fix by freeing both objects.
--- drivers/net/usb/rtl8150.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/usb/rtl8150.c +0 -0
@@ -211,6 +211,8 @@ static int async_set_registers(rtl8150_t *dev, u16
indx, u16 size, u16 reg)
if (res == -ENODEV)
netif_device_detach(dev->netdev);
dev_err(&dev->udev->dev, "%s failed with %d\n", __func__, res);
+ usb_free_urb(async_urb);
+ kfree(req);
}
return res; }
--
2.25.1
Quoted 26 lines · Raka Gunarto
async_set_registers()does not free the urb and req on theusb_submit_urb()call fail path. Fix by freeing both objects.Reported-by [email protected]Signed-off-by Raka Gunarto <[email protected]>--- drivers/net/usb/rtl8150.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/usb/rtl8150.c +2
-0@@ -211,6 +211,8 @@ static int async_set_registers(rtl8150_t *dev, u16 indx, u16 size, u16 reg)if (res == -ENODEV )netif_device_detach (dev->netdev);dev_err (&dev->udev->dev,"%s failed with %d\n" , __func__, res); +usb_free_urb (async_urb); +kfree (req); }return res;}
--
2.25.1