From: Marc Kleine-Budde Date: Sun, 30 Jul 2017 21:51:01 +0000 (+0200) Subject: can: raw: raw_bind(): bail out if can_family is not AF_CAN X-Git-Tag: Ubuntu-5.2.0-15.16~5092^2~156^2~1 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=adb552c31915415fdb374172085f174f459727ea;p=mirror_ubuntu-eoan-kernel.git 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 --- 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);