diff --git a/net/can/isotp.c b/net/can/isotp.c
index 608f8c24ae46b60722904eae1dd0dff23b91c571..a18450ffae0155f4fee2051cb0615529be8a1bce 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);