summaryrefslogtreecommitdiffstats
path: root/net/can/raw.c
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2017-07-30 23:51:01 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2018-01-05 11:12:08 +0100
commitadb552c31915415fdb374172085f174f459727ea (patch)
tree58a71eb129ccc4102fd236b0ef469e5f8f222359 /net/can/raw.c
parent2ef5e75706d87065bc382bf85f1503008a5a1e7a (diff)
downloadlinux-adb552c31915415fdb374172085f174f459727ea.tar.bz2
can: raw: raw_bind(): bail out if can_family is not AF_CAN
Until now CAN raw's bind() doesn't check if the can_familiy in the struct sockaddr_can is set to AF_CAN. This patch adds the missing check. Acked-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'net/can/raw.c')
-rw-r--r--net/can/raw.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/can/raw.c b/net/can/raw.c
index 864c80dbdb72..f2ecc43376a1 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -401,6 +401,8 @@ static int raw_bind(struct socket *sock, struct sockaddr *uaddr, int len)
if (len < sizeof(*addr))
return -EINVAL;
+ if (addr->can_family != AF_CAN)
+ return -EINVAL;
lock_sock(sk);