]> git.baikalelectronics.ru Git - kernel.git/commit
can: j1939: socket: j1939_sk_bind(): make sure ml_priv is allocated
authorOleksij Rempel <o.rempel@pengutronix.de>
Fri, 7 Aug 2020 10:51:58 +0000 (12:51 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Fri, 14 Aug 2020 10:38:47 +0000 (12:38 +0200)
commita88be2bbbaa1743bc65ec7eb2ad10f95181a82bb
treee0c1d9a5e5d3dc1167ab9625d3a11b24d80a98bc
parent405ceb5ab371228df1b63f87ffa47d1f58220c0b
can: j1939: socket: j1939_sk_bind(): make sure ml_priv is allocated

This patch adds check to ensure that the struct net_device::ml_priv is
allocated, as it is used later by the j1939 stack.

The allocation is done by all mainline CAN network drivers, but when using
bond or team devices this is not the case.

Bail out if no ml_priv is allocated.

Reported-by: syzbot+f03d384f3455d28833eb@syzkaller.appspotmail.com
Fixes: c4da2dabb66d ("can: add support of SAE J1939 protocol")
Cc: linux-stable <stable@vger.kernel.org> # >= v5.4
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20200807105200.26441-4-o.rempel@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
net/can/j1939/socket.c