linux/net/dsa
YueHaibing 68be930249 net: dsa: Fix error cleanup path in dsa_init_module
BUG: unable to handle kernel paging request at ffffffffa01c5430
PGD 3270067 P4D 3270067 PUD 3271063 PMD 230bc5067 PTE 0
Oops: 0000 [#1
CPU: 0 PID: 6159 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:raw_notifier_chain_register+0x16/0x40
Code: 63 f8 66 90 e9 5d ff ff ff 90 90 90 90 90 90 90 90 90 90 90 55 48 8b 07 48 89 e5 48 85 c0 74 1c 8b 56 10 3b 50 10 7e 07 eb 12 <39> 50 10 7c 0d 48 8d 78 08 48 8b 40 08 48 85 c0 75 ee 48 89 46 08
RSP: 0018:ffffc90001c33c08 EFLAGS: 00010282
RAX: ffffffffa01c5420 RBX: ffffffffa01db420 RCX: 4fcef45928070a8b
RDX: 0000000000000000 RSI: ffffffffa01db420 RDI: ffffffffa01b0068
RBP: ffffc90001c33c08 R08: 000000003e0a33d0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000094443661 R12: ffff88822c320700
R13: ffff88823109be80 R14: 0000000000000000 R15: ffffc90001c33e78
FS:  00007fab8bd08540(0000) GS:ffff888237a00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffa01c5430 CR3: 00000002297ea000 CR4: 00000000000006f0
Call Trace:
 register_netdevice_notifier+0x43/0x250
 ? 0xffffffffa01e0000
 dsa_slave_register_notifier+0x13/0x70 [dsa_core
 ? 0xffffffffa01e0000
 dsa_init_module+0x2e/0x1000 [dsa_core
 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

Cleanup allocated resourses if there are errors,
otherwise it will trgger memleak.

Fixes: c9eb3e0f87 ("net: dsa: Add support for learning FDB through notification")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-07 12:17:23 -07:00
..
dsa2.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-03-02 12:54:35 -08:00
dsa_priv.h net: dsa: add KSZ9893 switch tagging support 2019-03-03 13:48:49 -08:00
dsa.c net: dsa: Fix error cleanup path in dsa_init_module 2019-05-07 12:17:23 -07:00
Kconfig net: devlink: turn devlink into a built-in 2019-02-26 08:49:05 -08:00
legacy.c net: dsa: legacy: simplify getting .driver_data 2018-10-22 19:49:04 -07:00
Makefile net: dsa: Add Lantiq / Intel GSWIP tag support 2018-09-13 08:14:33 -07:00
master.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-02-08 15:00:17 -08:00
port.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-03-02 12:54:35 -08:00
slave.c net: dsa: Use prepare/commit phase in dsa_slave_vlan_rx_add_vid() 2019-03-03 20:45:52 -08:00
switch.c net: dsa: Add ndo_vlan_rx_{add, kill}_vid implementation 2019-02-22 11:53:32 -08:00
tag_brcm.c net: dsa: Add overhead to tag protocol ops. 2018-12-06 12:18:16 -08:00
tag_dsa.c net: dsa: Implement flow_dissect callback for tag_dsa. 2019-02-18 16:35:41 -08:00
tag_edsa.c net: dsa: Implement flow_dissect callback for tag_dsa. 2019-02-18 16:35:41 -08:00
tag_gswip.c net: dsa: Add overhead to tag protocol ops. 2018-12-06 12:18:16 -08:00
tag_ksz.c net: dsa: add KSZ9893 switch tagging support 2019-03-03 13:48:49 -08:00
tag_lan9303.c net: dsa: Add overhead to tag protocol ops. 2018-12-06 12:18:16 -08:00
tag_mtk.c net: dsa: Add overhead to tag protocol ops. 2018-12-06 12:18:16 -08:00
tag_qca.c net: dsa: Implement flow_dissect callback for tag_qca 2019-03-28 16:57:19 -07:00
tag_trailer.c net: dsa: Add overhead to tag protocol ops. 2018-12-06 12:18:16 -08:00