Commit 9b234a9
rtnetlink: fix rtnl_dump_ifinfo() error path
syzbot found that rtnl_dump_ifinfo() could return with a lock held [1]
Move code around so that rtnl_link_ops_put() and put_net()
can be called at the end of this function.
[1]
WARNING: lock held when returning to user space!
6.12.0-rc7-syzkaller-01681-g38f83a57aa8e #0 Not tainted
syz-executor399/5841 is leaving the kernel with locks still held!
1 lock held by syz-executor399/5841:
#0: ffffffff8f46c2a0 (&ops->srcu#2){.+.+}-{0:0}, at: rcu_lock_acquire include/linux/rcupdate.h:337 [inline]
#0: ffffffff8f46c2a0 (&ops->srcu#2){.+.+}-{0:0}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#0: ffffffff8f46c2a0 (&ops->srcu#2){.+.+}-{0:0}, at: rtnl_link_ops_get+0x22/0x250 net/core/rtnetlink.c:555
Fixes: 43c7ce6 ("rtnetlink: Protect struct rtnl_link_ops with SRCU.")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20241121194105.3632507-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent 078f644 commit 9b234a9
1 file changed
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2442 | 2442 | | |
2443 | 2443 | | |
2444 | 2444 | | |
2445 | | - | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
2446 | 2448 | | |
2447 | 2449 | | |
2448 | 2450 | | |
| |||
2457 | 2459 | | |
2458 | 2460 | | |
2459 | 2461 | | |
2460 | | - | |
| 2462 | + | |
| 2463 | + | |
2461 | 2464 | | |
2462 | 2465 | | |
2463 | 2466 | | |
| |||
2479 | 2482 | | |
2480 | 2483 | | |
2481 | 2484 | | |
2482 | | - | |
2483 | | - | |
2484 | 2485 | | |
2485 | 2486 | | |
2486 | 2487 | | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
2487 | 2493 | | |
2488 | 2494 | | |
2489 | 2495 | | |
| |||
0 commit comments