can: canxl: Fix unremoved canxl_packet in can_exit()
Subsystems (4)
PATCH 1/1 can: canxl: Fix unremoved canxl_packet in can_exit()
In can_init(), dev_add_pack(&canxl_packet) is added but not removed in can_exit(). It break the packet handler list and can make kernel panic when can_init() for the second time.
Quoted 2 lines
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 <[email protected]>
--- net/can/af_can.c | 1 + 1 file changed, 1 insertion(+)
net/can/af_can.c +1 -0
@@ -902,6 +902,7 @@ static __init int can_init(void) 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 );
Signature · 1 line
2.17.1
Quoted 15 lines · Chen Zhongjin
In
can_init(),dev_add_pack(&canxl_packet)is added but not removed incan_exit(). It break the packet handler list and can make kernel panic whencan_init()for the second time.Quoted 2 lines
modprobe can && rmmod can
rmmod xxx && modprobe canBUG: 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 ...
Quoted 2 lines
Fixes fb08cba12b52 ("can: canxl: update CAN infrastructure for CAN XL frames")Signed-off-by Chen Zhongjin <[email protected]>
Acked-by Oliver Hartkopp <[email protected]>
Thanks for the finding!
Best regards,
Oliver
Quoted 16 lines
--- net/can/af_can.c | 1 + 1 file changed, 1 insertion(+)net/can/af_can.c +1
-0@@ -902,6 +902,7 @@ static __init int can_init(void) 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 );