]> git.baikalelectronics.ru Git - 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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Dec 2022 10:30:44 +0000 (11:30 +0100)
commit690f4aadf6a1f6da9dcb652b86468ed13115584b
treef5063162eb3cd0193e500723e39c6762e3ddeb18
parent5a79faeae188fa15776673f0cd3e15b727004c73
can: af_can: fix NULL pointer dereference in can_rcv_filter

commit b1228e5cd2d35b9b552d5eef6f984b9d869814af upstream.

Analogue to commit 80003e2fa65a ("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 89493ac6383b ("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: 89493ac6383b ("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>
net/can/af_can.c