Revert "BACKPORT: packet: in packet_do_bind, test fanout with bind_lock held"

This reverts commit 6c83ad207f.
This commit is contained in:
syphyr 2018-05-27 23:00:29 +02:00
parent 45b9c6cdfc
commit b85711088b
1 changed files with 5 additions and 8 deletions

View File

@ -2519,20 +2519,17 @@ static int packet_release(struct socket *sock)
static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protocol)
{
struct packet_sock *po = pkt_sk(sk);
int ret = 0;
lock_sock(sk);
spin_lock(&po->bind_lock);
if (po->fanout) {
if (dev)
dev_put(dev);
ret = -EINVAL;
goto out_unlock;
return -EINVAL;
}
lock_sock(sk);
spin_lock(&po->bind_lock);
unregister_prot_hook(sk, true);
po->num = protocol;
@ -2559,7 +2556,7 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc
out_unlock:
spin_unlock(&po->bind_lock);
release_sock(sk);
return ret;
return 0;
}
/*