]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
can: raw: raw_bind(): bail out if can_family is not AF_CAN
authorMarc Kleine-Budde <mkl@pengutronix.de>
Sun, 30 Jul 2017 21:51:01 +0000 (23:51 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Fri, 5 Jan 2018 10:12:08 +0000 (11:12 +0100)
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>
net/can/raw.c

index 864c80dbdb72d11cdd24183cec3769222b339ccc..f2ecc43376a15993463401770d3ef41ca4cc3a33 100644 (file)
@@ -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);