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>
This commit is contained in:
Marc Kleine-Budde 2017-07-30 23:51:01 +02:00
Родитель 2ef5e75706
Коммит adb552c319
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -401,6 +401,8 @@ static int raw_bind(struct socket *sock, struct sockaddr *uaddr, int len)
if (len < sizeof(*addr)) if (len < sizeof(*addr))
return -EINVAL; return -EINVAL;
if (addr->can_family != AF_CAN)
return -EINVAL;
lock_sock(sk); lock_sock(sk);