]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
can: af_can: fix NULL pointer dereference in can_rcv_filter
authorOliver Hartkopp <socketcan@hartkopp.net>
Tue, 6 Dec 2022 20:12:59 +0000 (21:12 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 14 Dec 2022 13:02:55 +0000 (14:02 +0100)
commitc3cab4b24013757b2b3641631be1acf5b6a4fe5e
tree4a026d8cd1cc965b6001e8297a7f89fa52cdf433
parent55666b6b25ef076ed59bcacc6ef229ac4cb05671
can: af_can: fix NULL pointer dereference in can_rcv_filter

commit 0acc442309a0a1b01bcdaa135e56e6398a49439c upstream.

Analogue to commit 8aa59e355949 ("can: af_can: fix NULL pointer
dereference in can_rx_register()") we need to check for a missing
initialization of ml_priv in the receive path of CAN frames.

Since commit 4e096a18867a ("net: introduce CAN specific pointer in the
struct net_device") the check for dev->type to be ARPHRD_CAN is not
sufficient anymore since bonding or tun netdevices claim to be CAN
devices but do not initialize ml_priv accordingly.

Fixes: 4e096a18867a ("net: introduce CAN specific pointer in the struct net_device")
Reported-by: syzbot+2d7f58292cb5b29eb5ad@syzkaller.appspotmail.com
Reported-by: Wei Chen <harperchen1110@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/all/20221206201259.3028-1-socketcan@hartkopp.net
Cc: stable@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c142cba37de29f740a3852f01f59876af8ae462a)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
net/can/af_can.c