Skip to content

Commit af76322

Browse files
YueHaibinggregkh
YueHaibing
authored andcommitted
cxgb4: Fix error path in cxgb4_init_module
[ Upstream commit a314777 ] BUG: unable to handle kernel paging request at ffffffffa016a270 PGD 3270067 P4D 3270067 PUD 3271063 PMD 230bbd067 PTE 0 Oops: 0000 [#1 CPU: 0 PID: 6134 Comm: modprobe Not tainted 5.1.0+ #33 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014 RIP: 0010:atomic_notifier_chain_register+0x24/0x60 Code: 1f 80 00 00 00 00 55 48 89 e5 41 54 49 89 f4 53 48 89 fb e8 ae b4 38 01 48 8b 53 38 48 8d 4b 38 48 85 d2 74 20 45 8b 44 24 10 <44> 3b 42 10 7e 08 eb 13 44 39 42 10 7c 0d 48 8d 4a 08 48 8b 52 08 RSP: 0018:ffffc90000e2bc60 EFLAGS: 00010086 RAX: 0000000000000292 RBX: ffffffff83467240 RCX: ffffffff83467278 RDX: ffffffffa016a260 RSI: ffffffff83752140 RDI: ffffffff83467240 RBP: ffffc90000e2bc70 R08: 0000000000000000 R09: 0000000000000001 R10: 0000000000000000 R11: 00000000014fa61f R12: ffffffffa01c8260 R13: ffff888231091e00 R14: 0000000000000000 R15: ffffc90000e2be78 FS: 00007fbd8d7cd540(0000) GS:ffff888237a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffa016a270 CR3: 000000022c7e3000 CR4: 00000000000006f0 Call Trace: register_inet6addr_notifier+0x13/0x20 cxgb4_init_module+0x6c/0x1000 [cxgb4 ? 0xffffffffa01d7000 do_one_initcall+0x6c/0x3cc ? do_init_module+0x22/0x1f1 ? rcu_read_lock_sched_held+0x97/0xb0 ? kmem_cache_alloc_trace+0x325/0x3b0 do_init_module+0x5b/0x1f1 load_module+0x1db1/0x2690 ? m_show+0x1d0/0x1d0 __do_sys_finit_module+0xc5/0xd0 __x64_sys_finit_module+0x15/0x20 do_syscall_64+0x6b/0x1d0 entry_SYSCALL_64_after_hwframe+0x49/0xbe If pci_register_driver fails, register inet6addr_notifier is pointless. This patch fix the error path in cxgb4_init_module. Fixes: b5a02f5 ("cxgb4 : Update ipv6 address handling api") Signed-off-by: YueHaibing <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent b568ed3 commit af76322

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5203,15 +5203,24 @@ static int __init cxgb4_init_module(void)
52035203

52045204
ret = pci_register_driver(&cxgb4_driver);
52055205
if (ret < 0)
5206-
debugfs_remove(cxgb4_debugfs_root);
5206+
goto err_pci;
52075207

52085208
#if IS_ENABLED(CONFIG_IPV6)
52095209
if (!inet6addr_registered) {
5210-
register_inet6addr_notifier(&cxgb4_inet6addr_notifier);
5211-
inet6addr_registered = true;
5210+
ret = register_inet6addr_notifier(&cxgb4_inet6addr_notifier);
5211+
if (ret)
5212+
pci_unregister_driver(&cxgb4_driver);
5213+
else
5214+
inet6addr_registered = true;
52125215
}
52135216
#endif
52145217

5218+
if (ret == 0)
5219+
return ret;
5220+
5221+
err_pci:
5222+
debugfs_remove(cxgb4_debugfs_root);
5223+
52155224
return ret;
52165225
}
52175226

0 commit comments

Comments
 (0)