* [syzbot] [net?] general protection fault in rtnl_create_link
@ 2025-04-14 2:14 syzbot
2025-04-14 2:30 ` Kuniyuki Iwashima
0 siblings, 1 reply; 7+ messages in thread
From: syzbot @ 2025-04-14 2:14 UTC (permalink / raw)
To: cratiu, davem, edumazet, horms, kuba, kuniyu, linux-kernel,
netdev, pabeni, sdf, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: eaa517b77e63 ethtool: cmis_cdb: Fix incorrect read / write..
git tree: net
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1541f23f980000
kernel config: https://syzkaller.appspot.com/x/.config?x=f2054704dd53fb80
dashboard link: https://syzkaller.appspot.com/bug?extid=de1c7d68a10e3f123bdd
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1429874c580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1353f74c580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/8ff6a34dbd2f/disk-eaa517b7.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/80dc0689a89b/vmlinux-eaa517b7.xz
kernel image: https://storage.googleapis.com/syzbot-assets/093b749f228d/bzImage-eaa517b7.xz
The issue was bisected to:
commit 04efcee6ef8d0f01eef495db047e7216d6e6e38f
Author: Stanislav Fomichev <sdf@fomichev.me>
Date: Fri Apr 4 16:11:22 2025 +0000
net: hold instance lock during NETDEV_CHANGE
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=151db7e4580000
final oops: https://syzkaller.appspot.com/x/report.txt?x=171db7e4580000
console output: https://syzkaller.appspot.com/x/log.txt?x=131db7e4580000
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+de1c7d68a10e3f123bdd@syzkaller.appspotmail.com
Fixes: 04efcee6ef8d ("net: hold instance lock during NETDEV_CHANGE")
netlink: 4 bytes leftover after parsing attributes in process `syz-executor402'.
netlink: 'syz-executor402': attribute type 15 has an invalid length.
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000055: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x00000000000002a8-0x00000000000002af]
CPU: 0 UID: 0 PID: 5841 Comm: syz-executor402 Not tainted 6.14.0-syzkaller-13348-geaa517b77e63 #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
RIP: 0010:netdev_need_ops_lock include/net/netdev_lock.h:33 [inline]
RIP: 0010:netdev_lock_ops include/net/netdev_lock.h:41 [inline]
RIP: 0010:rtnl_create_link+0x6af/0xea0 net/core/rtnetlink.c:3680
Code: 24 20 42 80 3c 28 00 74 08 48 89 df e8 4a 3a 3b f8 4c 89 64 24 28 bd a8 02 00 00 48 89 5c 24 08 48 03 2b 48 89 e8 48 c1 e8 03 <42> 80 3c 28 00 74 08 48 89 ef e8 22 3a 3b f8 45 31 e4 48 83 7d 00
RSP: 0018:ffffc900040b6e70 EFLAGS: 00010206
RAX: 0000000000000055 RBX: ffff888035860008 RCX: ffff888030a01e00
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 00000000000002a8 R08: ffffffff89f245f9 R09: 1ffff92000816dfa
R10: dffffc0000000000 R11: fffff52000816dfb R12: ffff8880212e0080
R13: dffffc0000000000 R14: 0000000000000000 R15: ffff888035860000
FS: 000055556170f380(0000) GS:ffff888124f96000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000000045ad50 CR3: 000000007c1d2000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
rtnl_newlink_create+0x2f2/0xcb0 net/core/rtnetlink.c:3826
__rtnl_newlink net/core/rtnetlink.c:3953 [inline]
rtnl_newlink+0x18b0/0x1fe0 net/core/rtnetlink.c:4068
rtnetlink_rcv_msg+0x80f/0xd70 net/core/rtnetlink.c:6958
netlink_rcv_skb+0x208/0x480 net/netlink/af_netlink.c:2534
netlink_unicast_kernel net/netlink/af_netlink.c:1313 [inline]
netlink_unicast+0x7f8/0x9a0 net/netlink/af_netlink.c:1339
netlink_sendmsg+0x8c3/0xcd0 net/netlink/af_netlink.c:1883
sock_sendmsg_nosec net/socket.c:712 [inline]
__sock_sendmsg+0x221/0x270 net/socket.c:727
____sys_sendmsg+0x523/0x860 net/socket.c:2566
___sys_sendmsg net/socket.c:2620 [inline]
__sys_sendmsg+0x271/0x360 net/socket.c:2652
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7ff3d9feac39
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 c1 17 00 00 90 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:00007ffe861803d8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007ff3d9feac39
RDX: 0000000004000000 RSI: 0000200000000000 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000006 R09: 0000000000000006
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000200000000110 R14: 0000200000000088 R15: 0000000000000001
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:netdev_need_ops_lock include/net/netdev_lock.h:33 [inline]
RIP: 0010:netdev_lock_ops include/net/netdev_lock.h:41 [inline]
RIP: 0010:rtnl_create_link+0x6af/0xea0 net/core/rtnetlink.c:3680
Code: 24 20 42 80 3c 28 00 74 08 48 89 df e8 4a 3a 3b f8 4c 89 64 24 28 bd a8 02 00 00 48 89 5c 24 08 48 03 2b 48 89 e8 48 c1 e8 03 <42> 80 3c 28 00 74 08 48 89 ef e8 22 3a 3b f8 45 31 e4 48 83 7d 00
RSP: 0018:ffffc900040b6e70 EFLAGS: 00010206
RAX: 0000000000000055 RBX: ffff888035860008 RCX: ffff888030a01e00
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 00000000000002a8 R08: ffffffff89f245f9 R09: 1ffff92000816dfa
R10: dffffc0000000000 R11: fffff52000816dfb R12: ffff8880212e0080
R13: dffffc0000000000 R14: 0000000000000000 R15: ffff888035860000
FS: 000055556170f380(0000) GS:ffff888125096000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200000000140 CR3: 000000007c1d2000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: 24 20 and $0x20,%al
2: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1)
7: 74 08 je 0x11
9: 48 89 df mov %rbx,%rdi
c: e8 4a 3a 3b f8 call 0xf83b3a5b
11: 4c 89 64 24 28 mov %r12,0x28(%rsp)
16: bd a8 02 00 00 mov $0x2a8,%ebp
1b: 48 89 5c 24 08 mov %rbx,0x8(%rsp)
20: 48 03 2b add (%rbx),%rbp
23: 48 89 e8 mov %rbp,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1) <-- trapping instruction
2f: 74 08 je 0x39
31: 48 89 ef mov %rbp,%rdi
34: e8 22 3a 3b f8 call 0xf83b3a5b
39: 45 31 e4 xor %r12d,%r12d
3c: 48 rex.W
3d: 83 .byte 0x83
3e: 7d 00 jge 0x40
---
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@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [net?] general protection fault in rtnl_create_link
2025-04-14 2:14 [syzbot] [net?] general protection fault in rtnl_create_link syzbot
@ 2025-04-14 2:30 ` Kuniyuki Iwashima
2025-04-14 3:07 ` syzbot
2025-04-14 17:37 ` Jakub Kicinski
0 siblings, 2 replies; 7+ messages in thread
From: Kuniyuki Iwashima @ 2025-04-14 2:30 UTC (permalink / raw)
To: syzbot+de1c7d68a10e3f123bdd
Cc: cratiu, davem, edumazet, horms, kuba, kuniyu, linux-kernel,
netdev, pabeni, sdf, syzkaller-bugs
From: syzbot <syzbot+de1c7d68a10e3f123bdd@syzkaller.appspotmail.com>
Date: Sun, 13 Apr 2025 19:14:29 -0700
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: eaa517b77e63 ethtool: cmis_cdb: Fix incorrect read / write..
> git tree: net
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=1541f23f980000
> kernel config: https://syzkaller.appspot.com/x/.config?x=f2054704dd53fb80
> dashboard link: https://syzkaller.appspot.com/bug?extid=de1c7d68a10e3f123bdd
> compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1429874c580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1353f74c580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/8ff6a34dbd2f/disk-eaa517b7.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/80dc0689a89b/vmlinux-eaa517b7.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/093b749f228d/bzImage-eaa517b7.xz
>
> The issue was bisected to:
>
> commit 04efcee6ef8d0f01eef495db047e7216d6e6e38f
> Author: Stanislav Fomichev <sdf@fomichev.me>
> Date: Fri Apr 4 16:11:22 2025 +0000
>
> net: hold instance lock during NETDEV_CHANGE
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=151db7e4580000
> final oops: https://syzkaller.appspot.com/x/report.txt?x=171db7e4580000
> console output: https://syzkaller.appspot.com/x/log.txt?x=131db7e4580000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+de1c7d68a10e3f123bdd@syzkaller.appspotmail.com
> Fixes: 04efcee6ef8d ("net: hold instance lock during NETDEV_CHANGE")
>
> netlink: 4 bytes leftover after parsing attributes in process `syz-executor402'.
> netlink: 'syz-executor402': attribute type 15 has an invalid length.
> Oops: general protection fault, probably for non-canonical address 0xdffffc0000000055: 0000 [#1] SMP KASAN PTI
> KASAN: null-ptr-deref in range [0x00000000000002a8-0x00000000000002af]
> CPU: 0 UID: 0 PID: 5841 Comm: syz-executor402 Not tainted 6.14.0-syzkaller-13348-geaa517b77e63 #0 PREEMPT(full)
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
> RIP: 0010:netdev_need_ops_lock include/net/netdev_lock.h:33 [inline]
> RIP: 0010:netdev_lock_ops include/net/netdev_lock.h:41 [inline]
> RIP: 0010:rtnl_create_link+0x6af/0xea0 net/core/rtnetlink.c:3680
#syz test
diff --git a/include/net/netdev_lock.h b/include/net/netdev_lock.h
index 5706835a660c..270e157a4a79 100644
--- a/include/net/netdev_lock.h
+++ b/include/net/netdev_lock.h
@@ -30,7 +30,8 @@ static inline bool netdev_need_ops_lock(const struct net_device *dev)
bool ret = dev->request_ops_lock || !!dev->queue_mgmt_ops;
#if IS_ENABLED(CONFIG_NET_SHAPER)
- ret |= !!dev->netdev_ops->net_shaper_ops;
+ if (dev->netdev_ops)
+ ret |= !!dev->netdev_ops->net_shaper_ops;
#endif
return ret;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [syzbot] [net?] general protection fault in rtnl_create_link
2025-04-14 2:30 ` Kuniyuki Iwashima
@ 2025-04-14 3:07 ` syzbot
2025-04-14 17:37 ` Jakub Kicinski
1 sibling, 0 replies; 7+ messages in thread
From: syzbot @ 2025-04-14 3:07 UTC (permalink / raw)
To: cratiu, davem, edumazet, horms, kuba, kuniyu, linux-kernel,
netdev, pabeni, sdf, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
unregister_netdevice: waiting for DEV to become free
unregister_netdevice: waiting for batadv0 to become free. Usage count = 3
Tested on:
commit: 8c941f14 Merge branch 'there-are-some-bugfix-for-hibmc..
git tree: net
console output: https://syzkaller.appspot.com/x/log.txt?x=15bab398580000
kernel config: https://syzkaller.appspot.com/x/.config?x=eecd7902e39d7933
dashboard link: https://syzkaller.appspot.com/bug?extid=de1c7d68a10e3f123bdd
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1661c0cc580000
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [net?] general protection fault in rtnl_create_link
2025-04-14 2:30 ` Kuniyuki Iwashima
2025-04-14 3:07 ` syzbot
@ 2025-04-14 17:37 ` Jakub Kicinski
2025-04-14 18:01 ` Kuniyuki Iwashima
1 sibling, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2025-04-14 17:37 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: syzbot+de1c7d68a10e3f123bdd, cratiu, davem, edumazet, horms,
linux-kernel, netdev, pabeni, sdf, syzkaller-bugs
On Sun, 13 Apr 2025 19:30:46 -0700 Kuniyuki Iwashima wrote:
> diff --git a/include/net/netdev_lock.h b/include/net/netdev_lock.h
> index 5706835a660c..270e157a4a79 100644
> --- a/include/net/netdev_lock.h
> +++ b/include/net/netdev_lock.h
> @@ -30,7 +30,8 @@ static inline bool netdev_need_ops_lock(const struct net_device *dev)
> bool ret = dev->request_ops_lock || !!dev->queue_mgmt_ops;
>
> #if IS_ENABLED(CONFIG_NET_SHAPER)
> - ret |= !!dev->netdev_ops->net_shaper_ops;
> + if (dev->netdev_ops)
> + ret |= !!dev->netdev_ops->net_shaper_ops;
> #endif
This is a bit surprising, we pretty much never validate if dev has ops.
I think we're guaranteed that IFF_UP will not be set if we just
allocated the device, so we can remove the locks in rtnl_create_link()
and to double confirm add a netdev_ops_assert_locked_or_invisible()
in netif_state_change() ?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [net?] general protection fault in rtnl_create_link
2025-04-14 17:37 ` Jakub Kicinski
@ 2025-04-14 18:01 ` Kuniyuki Iwashima
2025-04-14 18:15 ` Jakub Kicinski
0 siblings, 1 reply; 7+ messages in thread
From: Kuniyuki Iwashima @ 2025-04-14 18:01 UTC (permalink / raw)
To: kuba
Cc: cratiu, davem, edumazet, horms, kuniyu, linux-kernel, netdev,
pabeni, sdf, syzbot+de1c7d68a10e3f123bdd, syzkaller-bugs
From: Jakub Kicinski <kuba@kernel.org>
Date: Mon, 14 Apr 2025 10:37:27 -0700
> On Sun, 13 Apr 2025 19:30:46 -0700 Kuniyuki Iwashima wrote:
> > diff --git a/include/net/netdev_lock.h b/include/net/netdev_lock.h
> > index 5706835a660c..270e157a4a79 100644
> > --- a/include/net/netdev_lock.h
> > +++ b/include/net/netdev_lock.h
> > @@ -30,7 +30,8 @@ static inline bool netdev_need_ops_lock(const struct net_device *dev)
> > bool ret = dev->request_ops_lock || !!dev->queue_mgmt_ops;
> >
> > #if IS_ENABLED(CONFIG_NET_SHAPER)
> > - ret |= !!dev->netdev_ops->net_shaper_ops;
> > + if (dev->netdev_ops)
> > + ret |= !!dev->netdev_ops->net_shaper_ops;
> > #endif
>
> This is a bit surprising, we pretty much never validate if dev has ops.
>
> I think we're guaranteed that IFF_UP will not be set if we just
> allocated the device, so we can remove the locks in rtnl_create_link()
> and to double confirm add a netdev_ops_assert_locked_or_invisible()
> in netif_state_change() ?
Removing the lock from NEWLINK makes sense, but my concern
was NETDEV_CHANGE, which will requires more caution ?
commit 04efcee6ef8d0f01eef495db047e7216d6e6e38f
Author: Stanislav Fomichev <sdf@fomichev.me>
Date: Fri Apr 4 09:11:22 2025 -0700
net: hold instance lock during NETDEV_CHANGE
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [net?] general protection fault in rtnl_create_link
2025-04-14 18:01 ` Kuniyuki Iwashima
@ 2025-04-14 18:15 ` Jakub Kicinski
2025-04-14 18:23 ` Kuniyuki Iwashima
0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2025-04-14 18:15 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: cratiu, davem, edumazet, horms, linux-kernel, netdev, pabeni, sdf,
syzbot+de1c7d68a10e3f123bdd, syzkaller-bugs
On Mon, 14 Apr 2025 11:01:59 -0700 Kuniyuki Iwashima wrote:
> From: Jakub Kicinski <kuba@kernel.org>
> Date: Mon, 14 Apr 2025 10:37:27 -0700
> > On Sun, 13 Apr 2025 19:30:46 -0700 Kuniyuki Iwashima wrote:
> > > diff --git a/include/net/netdev_lock.h b/include/net/netdev_lock.h
> > > index 5706835a660c..270e157a4a79 100644
> > > --- a/include/net/netdev_lock.h
> > > +++ b/include/net/netdev_lock.h
> > > @@ -30,7 +30,8 @@ static inline bool netdev_need_ops_lock(const struct net_device *dev)
> > > bool ret = dev->request_ops_lock || !!dev->queue_mgmt_ops;
> > >
> > > #if IS_ENABLED(CONFIG_NET_SHAPER)
> > > - ret |= !!dev->netdev_ops->net_shaper_ops;
> > > + if (dev->netdev_ops)
> > > + ret |= !!dev->netdev_ops->net_shaper_ops;
> > > #endif
> >
> > This is a bit surprising, we pretty much never validate if dev has ops.
> >
> > I think we're guaranteed that IFF_UP will not be set if we just
> > allocated the device, so we can remove the locks in rtnl_create_link()
> > and to double confirm add a netdev_ops_assert_locked_or_invisible()
> > in netif_state_change() ?
>
> Removing the lock from NEWLINK makes sense, but my concern
> was NETDEV_CHANGE, which will requires more caution ?
>
> commit 04efcee6ef8d0f01eef495db047e7216d6e6e38f
> Author: Stanislav Fomichev <sdf@fomichev.me>
> Date: Fri Apr 4 09:11:22 2025 -0700
>
> net: hold instance lock during NETDEV_CHANGE
How could we fire a notifier for a device that hasn't been initialized,
let alone registered?
I'm hoping that the _or_invisible assert in my suggestion will flag to
future developers trying to change netif_state_change() that the device
here may not be fully constructed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [net?] general protection fault in rtnl_create_link
2025-04-14 18:15 ` Jakub Kicinski
@ 2025-04-14 18:23 ` Kuniyuki Iwashima
0 siblings, 0 replies; 7+ messages in thread
From: Kuniyuki Iwashima @ 2025-04-14 18:23 UTC (permalink / raw)
To: kuba
Cc: cratiu, davem, edumazet, horms, kuniyu, linux-kernel, netdev,
pabeni, sdf, syzbot+de1c7d68a10e3f123bdd, syzkaller-bugs
From: Jakub Kicinski <kuba@kernel.org>
Date: Mon, 14 Apr 2025 11:15:36 -0700
> On Mon, 14 Apr 2025 11:01:59 -0700 Kuniyuki Iwashima wrote:
> > From: Jakub Kicinski <kuba@kernel.org>
> > Date: Mon, 14 Apr 2025 10:37:27 -0700
> > > On Sun, 13 Apr 2025 19:30:46 -0700 Kuniyuki Iwashima wrote:
> > > > diff --git a/include/net/netdev_lock.h b/include/net/netdev_lock.h
> > > > index 5706835a660c..270e157a4a79 100644
> > > > --- a/include/net/netdev_lock.h
> > > > +++ b/include/net/netdev_lock.h
> > > > @@ -30,7 +30,8 @@ static inline bool netdev_need_ops_lock(const struct net_device *dev)
> > > > bool ret = dev->request_ops_lock || !!dev->queue_mgmt_ops;
> > > >
> > > > #if IS_ENABLED(CONFIG_NET_SHAPER)
> > > > - ret |= !!dev->netdev_ops->net_shaper_ops;
> > > > + if (dev->netdev_ops)
> > > > + ret |= !!dev->netdev_ops->net_shaper_ops;
> > > > #endif
> > >
> > > This is a bit surprising, we pretty much never validate if dev has ops.
> > >
> > > I think we're guaranteed that IFF_UP will not be set if we just
> > > allocated the device, so we can remove the locks in rtnl_create_link()
> > > and to double confirm add a netdev_ops_assert_locked_or_invisible()
> > > in netif_state_change() ?
> >
> > Removing the lock from NEWLINK makes sense, but my concern
> > was NETDEV_CHANGE, which will requires more caution ?
> >
> > commit 04efcee6ef8d0f01eef495db047e7216d6e6e38f
> > Author: Stanislav Fomichev <sdf@fomichev.me>
> > Date: Fri Apr 4 09:11:22 2025 -0700
> >
> > net: hold instance lock during NETDEV_CHANGE
>
> How could we fire a notifier for a device that hasn't been initialized,
> let alone registered?
Ah, now got it. Exactly, we won't trigger NETDEV_CHANGE in the path,
rtnl_configure_link() is the place where IFF_UP is flagged later also
under the ops lock.
>
> I'm hoping that the _or_invisible assert in my suggestion will flag to
> future developers trying to change netif_state_change() that the device
> here may not be fully constructed.
Totally agree now.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-04-14 18:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 2:14 [syzbot] [net?] general protection fault in rtnl_create_link syzbot
2025-04-14 2:30 ` Kuniyuki Iwashima
2025-04-14 3:07 ` syzbot
2025-04-14 17:37 ` Jakub Kicinski
2025-04-14 18:01 ` Kuniyuki Iwashima
2025-04-14 18:15 ` Jakub Kicinski
2025-04-14 18:23 ` Kuniyuki Iwashima
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).