diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 84dbe21b71e5ea39bda5fc73003501e0bb30e6f8..96a3559f2a0948a5258b0509888ef470ecc5fd59 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -287,7 +287,9 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) /* Binding to link-local address requires an interface */ if (!sk->sk_bound_dev_if) goto out_unlock; + } + if (sk->sk_bound_dev_if) { err = -ENODEV; dev = dev_get_by_index_rcu(sock_net(sk), sk->sk_bound_dev_if);