Skip to content

Commit cfed9aa

Browse files
author
Al Stone
committed
can: af_can: can_exit(): add missing dev_remove_pack() of canxl_packet
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2071839 Tested: This is one of a series of patch sets to enable Arm SystemReady IR support. This set updates the CAN driver subsystem. This set has been tested on NXP imx8mm and NV Jetson Xavier NX via simple boot tests, using cansend/candump from can-utils to pass messages through a virtual CAN interface, and of course the CI loop. commit a3335fa Author: Chen Zhongjin <chenzhongjin@huawei.com> Date: Mon Oct 31 11:30:53 2022 +0800 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: fb08cba ("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> (cherry picked from commit a3335fa) Signed-off-by: Al Stone <ahs3@redhat.com>
1 parent b88d097 commit cfed9aa

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/can/af_can.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,7 @@ static __init int can_init(void)
902902
static __exit void can_exit(void)
903903
{
904904
/* protocol unregister */
905+
dev_remove_pack(&canxl_packet);
905906
dev_remove_pack(&canfd_packet);
906907
dev_remove_pack(&can_packet);
907908
sock_unregister(PF_CAN);

0 commit comments

Comments
 (0)