diff options
author | Colin Ian King <colin.king@canonical.com> | 2017-09-08 16:02:35 +0100 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2017-10-19 13:05:53 +0200 |
commit | 62c04647c6f44fa3d5d0c077133da0aa1cbbc34c (patch) | |
tree | ca5e5a25d5f15253d5ab5bdf23cfef4a9411e01e /net/can/af_can.c | |
parent | fb5b91d61bebc24686ffc379138fd67808b1a1e6 (diff) | |
download | op-kernel-dev-62c04647c6f44fa3d5d0c077133da0aa1cbbc34c.zip op-kernel-dev-62c04647c6f44fa3d5d0c077133da0aa1cbbc34c.tar.gz |
can: bcm: check for null sk before deferencing it via the call to sock_net
The assignment of net via call sock_net will dereference sk. This
is performed before a sanity null check on sk, so there could be
a potential null dereference on the sock_net call if sk is null.
Fix this by assigning net after the sk null check. Also replace
the sk == NULL with the more usual !sk idiom.
Detected by CoverityScan CID#1431862 ("Dereference before null check")
Fixes: 384317ef4187 ("can: network namespace support for CAN_BCM protocol")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'net/can/af_can.c')
0 files changed, 0 insertions, 0 deletions