summaryrefslogtreecommitdiff
path: root/net/can
diff options
context:
space:
mode:
authorChen Zhongjin <chenzhongjin@huawei.com>2022-10-31 11:30:53 +0800
committerMarc Kleine-Budde <mkl@pengutronix.de>2022-11-07 13:43:02 +0100
commita3335faebe1608f3e78e24f09501c9f7d5ebf87a (patch)
tree6989cabfa35082436fcfab717247335fc707fce7 /net/can
parentc23fb2c82267638f9d206cb96bb93e1f93ad7828 (diff)
can: af_can: can_exit(): add missing dev_remove_pack() of canxl_packet
In can_init(), dev_add_pack(&canxl_packet) is added but not removed in can_exit(). It breaks the packet handler list and can make kernel panic when can_init() is called for the second time. | > modprobe can && rmmod can | > rmmod xxx && modprobe can | | BUG: unable to handle page fault for address: fffffbfff807d7f4 | RIP: 0010:dev_add_pack+0x133/0x1f0 | Call Trace: | <TASK> | can_init+0xaa/0x1000 [can] | do_one_initcall+0xd3/0x4e0 | ... Fixes: fb08cba12b52 ("can: canxl: update CAN infrastructure for CAN XL frames") Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net> Link: https://lore.kernel.org/all/20221031033053.37849-1-chenzhongjin@huawei.com [mkl: adjust subject and commit message] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'net/can')
-rw-r--r--net/can/af_can.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 9503ab10f9b8..5e9e3e1e9825 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -902,6 +902,7 @@ out_pernet:
static __exit void can_exit(void)
{
/* protocol unregister */
+ dev_remove_pack(&canxl_packet);
dev_remove_pack(&canfd_packet);
dev_remove_pack(&can_packet);
sock_unregister(PF_CAN);