linux_dsm_epyc7002/net/can
Norbert Slusarek 0dac8b0ad0 can: j1939: j1939_sk_setsockopt(): prevent allocation of j1939 filter for optlen == 0
[ Upstream commit aaf473d0100f64abc88560e2bea905805bcf2a8e ]

If optval != NULL and optlen == 0 are specified for SO_J1939_FILTER in
j1939_sk_setsockopt(), memdup_sockptr() will return ZERO_PTR for 0
size allocation. The new filter will be mistakenly assigned ZERO_PTR.
This patch checks for optlen != 0 and filter will be assigned NULL in
case of optlen == 0.

Fixes: 9d71dd0c70 ("can: add support of SAE J1939 protocol")
Link: https://lore.kernel.org/r/20210620123842.117975-1-nslusarek@gmx.net
Signed-off-by: Norbert Slusarek <nslusarek@gmx.net>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-07-14 16:56:27 +02:00
..
j1939 can: j1939: j1939_sk_setsockopt(): prevent allocation of j1939 filter for optlen == 0 2021-07-14 16:56:27 +02:00
af_can.c net: introduce CAN specific pointer in the struct net_device 2021-04-07 15:00:07 +02:00
af_can.h can: introduce CAN midlayer private and allocate it automatically 2019-09-04 13:29:14 +02:00
bcm.c can: bcm: delay release of struct bcm_op after synchronize_rcu() 2021-07-14 16:55:41 +02:00
gw.c can: gw: synchronize rcu operations before removing gw job entry 2021-07-14 16:55:41 +02:00
isotp.c can: isotp: isotp_release(): omit unintended hrtimer restart on socket release 2021-07-14 16:55:41 +02:00
Kconfig can: isotp: Explain PDU in CAN_ISOTP help text 2020-11-03 22:30:31 +01:00
Makefile can: add ISO 15765-2:2016 transport protocol 2020-10-07 23:18:33 +02:00
proc.c net: introduce CAN specific pointer in the struct net_device 2021-04-07 15:00:07 +02:00
raw.c can: bcm/raw/isotp: use per module netdevice notifier 2021-06-23 14:42:50 +02:00