diff --git a/net/core/sock.c b/net/core/sock.c index 296907faf35e..1c9d99fe59cb 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -578,7 +578,7 @@ static int sock_bindtoindex_locked(struct sock *sk, int ifindex) /* Sorry... */ ret = -EPERM; - if (!ns_capable(net->user_ns, CAP_NET_RAW)) + if (sk->sk_bound_dev_if && !ns_capable(net->user_ns, CAP_NET_RAW)) goto out; ret = -EINVAL;