[syzbot] WARNING: refcount bug in nsim_destroy

From: syzbot
Date: Thu Nov 18 2021 - 04:31:33 EST


Hello,

syzbot found the following issue on:

HEAD commit: 66f4beaa6c1d Merge branch 'linus' of git://git.kernel.org/..
git tree: net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=15ff99c6b00000
kernel config: https://syzkaller.appspot.com/x/.config?x=a262045c4c15a9e0
dashboard link: https://syzkaller.appspot.com/bug?extid=0d65c9e2e3bcb8873be4
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+0d65c9e2e3bcb8873be4@xxxxxxxxxxxxxxxxxxxxxxxxx

netdevsim netdevsim4 netdevsim2 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
------------[ cut here ]------------
refcount_t: decrement hit 0; leaking memory.
WARNING: CPU: 1 PID: 13920 at lib/refcount.c:31 refcount_warn_saturate+0xbf/0x1e0 lib/refcount.c:31
Modules linked in:
CPU: 1 PID: 13920 Comm: syz-executor.4 Not tainted 5.15.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:refcount_warn_saturate+0xbf/0x1e0 lib/refcount.c:31
Code: 1d 9e 9c 81 09 31 ff 89 de e8 6d 11 9d fd 84 db 75 e0 e8 84 0d 9d fd 48 c7 c7 60 cb e4 89 c6 05 7e 9c 81 09 01 e8 78 77 1c 05 <0f> 0b eb c4 e8 68 0d 9d fd 0f b6 1d 6d 9c 81 09 31 ff 89 de e8 38
RSP: 0018:ffffc90002d5f1e8 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000040000 RSI: ffffffff815f39c8 RDI: fffff520005abe2f
RBP: 0000000000000004 R08: 0000000000000000 R09: 0000000000000000
R10: ffffffff815ed79e R11: 0000000000000000 R12: 0000000000000001
R13: ffffc90002d5f330 R14: ffff88807c3545b0 R15: ffff888071c4a400
FS: 00007fa593aa9700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2ca2c000 CR3: 000000003d640000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__refcount_dec include/linux/refcount.h:344 [inline]
refcount_dec include/linux/refcount.h:359 [inline]
dev_put include/linux/netdevice.h:4166 [inline]
unregister_netdevice_many+0x12c9/0x1790 net/core/dev.c:11114
unregister_netdevice_queue+0x2dd/0x3c0 net/core/dev.c:11011
unregister_netdevice include/linux/netdevice.h:2989 [inline]
nsim_destroy+0x3f/0x190 drivers/net/netdevsim/netdev.c:382
__nsim_dev_port_del+0x191/0x250 drivers/net/netdevsim/dev.c:1429
nsim_dev_port_del_all drivers/net/netdevsim/dev.c:1442 [inline]
nsim_dev_reload_destroy+0x12b/0x300 drivers/net/netdevsim/dev.c:1650
nsim_dev_reload_down+0xdf/0x180 drivers/net/netdevsim/dev.c:964
devlink_reload+0x53b/0x6b0 net/core/devlink.c:4042
devlink_nl_cmd_reload+0x6ed/0x11d0 net/core/devlink.c:4163
genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:731
genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:792
netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2491
genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1345
netlink_sendmsg+0x86d/0xda0 net/netlink/af_netlink.c:1916
sock_sendmsg_nosec net/socket.c:704 [inline]
sock_sendmsg+0xcf/0x120 net/socket.c:724
____sys_sendmsg+0x6e8/0x810 net/socket.c:2409
___sys_sendmsg+0xf3/0x170 net/socket.c:2463
__sys_sendmsg+0xe5/0x1b0 net/socket.c:2492
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7fa596533ae9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fa593aa9188 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fa596646f60 RCX: 00007fa596533ae9
RDX: 0000000000000000 RSI: 00000000200003c0 RDI: 0000000000000003
RBP: 00007fa59658df6d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffed384289f R14: 00007fa593aa9300 R15: 0000000000022000
</TASK>


---
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 syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.