Skip to content

Commit adb552c

Browse files
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>
1 parent 2ef5e75 commit adb552c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎net/can/raw.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,8 @@ static int raw_bind(struct socket *sock, struct sockaddr *uaddr, int len)
401401

402402
if (len < sizeof(*addr))
403403
return -EINVAL;
404+
if (addr->can_family != AF_CAN)
405+
return -EINVAL;
404406

405407
lock_sock(sk);
406408

0 commit comments

Comments
 (0)