From adb552c31915415fdb374172085f174f459727ea Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Sun, 30 Jul 2017 23:51:01 +0200 Subject: 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 Signed-off-by: Marc Kleine-Budde --- net/can/raw.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'net/can/raw.c') diff --git a/net/can/raw.c b/net/can/raw.c index 864c80d..f2ecc43 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); -- cgit v1.1