diff --git a/net/can/isotp.c b/net/can/isotp.c index 608f8c24ae46..a18450ffae01 100644 --- a/net/can/isotp.c +++ b/net/can/isotp.c @@ -1225,6 +1225,9 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len) if (len < ISOTP_MIN_NAMELEN) return -EINVAL; + if (addr->can_family != AF_CAN) + return -EINVAL; + /* sanitize tx CAN identifier */ if (tx_id & CAN_EFF_FLAG) tx_id &= (CAN_EFF_FLAG | CAN_EFF_MASK);