syzbot


WARNING: refcount bug in ethnl_phy_done

Status: upstream: reported C repro on 2024/09/11 08:00
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+e9ed4e4368d450c8f9db@syzkaller.appspotmail.com
Fix commit: 1ad84a151af7 net: ethtool: phy: Don't set the context dev pointer for unfiltered DUMP
Patched on: [ci-qemu-gce-upstream-auto ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-qemu2-riscv64 ci-snapshot-upstream-root ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-badwrites-root ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce-386-root ci-upstream-kmsan-gce-root ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu-native-arm64-kvm]
First crash: 34d, last: 34d
Cause bisection: introduced by (bisect log) :
commit 17194be4c8e1e82d8b484e58cdcb495c0714d1fd
Author: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date: Wed Aug 21 15:10:01 2024 +0000

  net: ethtool: Introduce a command to list PHYs on an interface

Crash: WARNING: refcount bug in ethnl_phy_done (log)
Repro: C syz .config
  
Discussions (4)
Title Replies (including bot) Last reply
[PATCH net-next] net: ethtool: phy: Distinguish whether dev is got by phy start or doit 4 (4) 2024/09/16 07:38
[PATCH net-next] net: ethtool: phy: Don't set the context dev pointer for unfiltered DUMP 3 (3) 2024/09/14 04:50
[syzbot] [net?] WARNING: refcount bug in ethnl_phy_done 3 (6) 2024/09/13 07:27
[PATCH net-next] net: ethtool: phy: Clear the netdev context pointer for DUMP requests 3 (3) 2024/09/13 07:14
Last patch testing requests (3)
Created Duration User Patch Repo Result
2024/09/13 07:27 21m lizhi.xu@windriver.com patch net-next OK log
2024/09/13 01:51 1h43m lizhi.xu@windriver.com patch net-next OK log
2024/09/10 16:40 1h48m edumazet@google.com patch net-next report log

Sample crash report:
------------[ cut here ]------------
refcount_t: decrement hit 0; leaking memory.
WARNING: CPU: 0 PID: 5227 at lib/refcount.c:31 refcount_warn_saturate+0xfa/0x1d0 lib/refcount.c:31
Modules linked in:
CPU: 0 UID: 0 PID: 5227 Comm: syz-executor281 Not tainted 6.11.0-rc6-syzkaller-01235-ga9b1fab3b69f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:refcount_warn_saturate+0xfa/0x1d0 lib/refcount.c:31
Code: b2 00 00 00 e8 e7 09 e1 fc 5b 5d c3 cc cc cc cc e8 db 09 e1 fc c6 05 56 d4 4f 0b 01 90 48 c7 c7 c0 3b 60 8c e8 f7 2d a3 fc 90 <0f> 0b 90 90 eb d9 e8 bb 09 e1 fc c6 05 33 d4 4f 0b 01 90 48 c7 c7
RSP: 0018:ffffc900033ff048 EFLAGS: 00010246
RAX: 033d767773c83300 RBX: ffff88802f8d0664 RCX: ffff8880506e0000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000004 R08: ffffffff8155b372 R09: 1ffff1101710519a
R10: dffffc0000000000 R11: ffffed101710519b R12: ffff88802f8d0620
R13: 0000000000000000 R14: ffff88802f8d0664 R15: dffffc0000000000
FS:  00005555884f4380(0000) GS:ffff8880b8800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055c9aad930a8 CR3: 0000000052acc000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __refcount_dec include/linux/refcount.h:336 [inline]
 refcount_dec include/linux/refcount.h:351 [inline]
 ref_tracker_free+0x6af/0x7e0 lib/ref_tracker.c:236
 netdev_tracker_free include/linux/netdevice.h:4057 [inline]
 netdev_put include/linux/netdevice.h:4074 [inline]
 ethnl_parse_header_dev_put net/ethtool/netlink.h:271 [inline]
 ethnl_phy_done+0x6f/0x100 net/ethtool/phy.c:238
 genl_done+0x136/0x210 net/netlink/genetlink.c:1043
 netlink_dump+0x9b2/0xd80 net/netlink/af_netlink.c:2370
 __netlink_dump_start+0x5a2/0x790 net/netlink/af_netlink.c:2440
 genl_family_rcv_msg_dumpit net/netlink/genetlink.c:1076 [inline]
 genl_family_rcv_msg net/netlink/genetlink.c:1192 [inline]
 genl_rcv_msg+0x88c/0xec0 net/netlink/genetlink.c:1210
 netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2550
 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219
 netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline]
 netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1357
 netlink_sendmsg+0x8e4/0xcb0 net/netlink/af_netlink.c:1901
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg+0x221/0x270 net/socket.c:745
 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2597
 ___sys_sendmsg net/socket.c:2651 [inline]
 __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2680
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f7cf874a219
Code: 48 83 c4 28 c3 e8 e7 18 00 00 0f 1f 80 00 00 00 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffff97db218 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007ffff97db3e8 RCX: 00007f7cf874a219
RDX: 0000000000000000 RSI: 0000000020001900 RDI: 0000000000000003
RBP: 00007f7cf87bc610 R08: 00007ffff97db3e8 R09: 00007ffff97db3e8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffff97db3d8 R14: 0000000000000001 R15: 0000000000000001
 </TASK>

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/09/10 18:25 net-next a9b1fab3b69f 784df80e .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in ethnl_phy_done
2024/09/10 17:17 net-next a9b1fab3b69f 784df80e .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in ethnl_phy_done
2024/09/10 15:56 net-next a9b1fab3b69f 784df80e .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in ethnl_phy_done
2024/09/10 14:46 net-next a9b1fab3b69f 784df80e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in ethnl_phy_done
* Struck through repros no longer work on HEAD.