Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 255339
b: refs/heads/master
c: 160ff18
h: refs/heads/master
i:
  255337: 707355c
  255335: 6d3a471
v: v3
  • Loading branch information
Ben Greear authored and David S. Miller committed Jun 5, 2011
1 parent 89ff65b commit 025ea30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e990b37b906b6137d353ef2a918e15e5763d70ec
refs/heads/master: 160ff18a07f3a505d452dcced8e45ecdd0a85506
14 changes: 9 additions & 5 deletions trunk/net/packet/af_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,10 @@ static int packet_release(struct socket *sock)
__dev_remove_pack(&po->prot_hook);
__sock_put(sk);
}
if (po->prot_hook.dev) {
dev_put(po->prot_hook.dev);
po->prot_hook.dev = NULL;
}
spin_unlock(&po->bind_lock);

packet_flush_mclist(sk);
Expand Down Expand Up @@ -1395,6 +1399,8 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc

po->num = protocol;
po->prot_hook.type = protocol;
if (po->prot_hook.dev)
dev_put(po->prot_hook.dev);
po->prot_hook.dev = dev;

po->ifindex = dev ? dev->ifindex : 0;
Expand Down Expand Up @@ -1439,10 +1445,8 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr,
strlcpy(name, uaddr->sa_data, sizeof(name));

dev = dev_get_by_name(sock_net(sk), name);
if (dev) {
if (dev)
err = packet_do_bind(sk, dev, pkt_sk(sk)->num);
dev_put(dev);
}
return err;
}

Expand Down Expand Up @@ -1470,8 +1474,6 @@ static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len
goto out;
}
err = packet_do_bind(sk, dev, sll->sll_protocol ? : pkt_sk(sk)->num);
if (dev)
dev_put(dev);

out:
return err;
Expand Down Expand Up @@ -2240,6 +2242,8 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void
}
if (msg == NETDEV_UNREGISTER) {
po->ifindex = -1;
if (po->prot_hook.dev)
dev_put(po->prot_hook.dev);
po->prot_hook.dev = NULL;
}
spin_unlock(&po->bind_lock);
Expand Down

0 comments on commit 025ea30

Please sign in to comment.