Skip to content

Commit

Permalink
can: raw: raw_bind(): bail out if can_family is not AF_CAN
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marc Kleine-Budde committed Jan 5, 2018
1 parent 2ef5e75 commit adb552c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/can/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit adb552c

Please sign in to comment.