diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2017-07-30 23:51:01 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2018-01-05 11:12:08 +0100 |
commit | adb552c31915415fdb374172085f174f459727ea (patch) | |
tree | 58a71eb129ccc4102fd236b0ef469e5f8f222359 /net/can/raw.c | |
parent | can: slcan: slc_alloc(): remove unused parameter "dev_t line" (diff) | |
download | linux-adb552c31915415fdb374172085f174f459727ea.tar.xz linux-adb552c31915415fdb374172085f174f459727ea.zip |
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.c | 2 |
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); |