lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221031033053.37849-1-chenzhongjin@huawei.com>
Date:   Mon, 31 Oct 2022 11:30:53 +0800
From:   Chen Zhongjin <chenzhongjin@...wei.com>
To:     <linux-kernel@...r.kernel.org>, <linux-can@...r.kernel.org>,
        <netdev@...r.kernel.org>
CC:     <socketcan@...tkopp.net>, <mkl@...gutronix.de>,
        <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
        <pabeni@...hat.com>, <mailhol.vincent@...adoo.fr>,
        <chenzhongjin@...wei.com>
Subject: [PATCH] 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.

> 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@...wei.com>
---
 net/can/af_can.c | 1 +
 1 file changed, 1 insertion(+)

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 @@ 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);
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ