diff options
-rw-r--r-- | net/packet/af_packet.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index c9e8741226c6..c7c42eb617ef 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -2784,7 +2784,7 @@ static int packet_release(struct socket *sock) | |||
2784 | static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) | 2784 | static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) |
2785 | { | 2785 | { |
2786 | struct packet_sock *po = pkt_sk(sk); | 2786 | struct packet_sock *po = pkt_sk(sk); |
2787 | const struct net_device *dev_curr; | 2787 | struct net_device *dev_curr; |
2788 | __be16 proto_curr; | 2788 | __be16 proto_curr; |
2789 | bool need_rehook; | 2789 | bool need_rehook; |
2790 | 2790 | ||
@@ -2808,15 +2808,13 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) | |||
2808 | 2808 | ||
2809 | po->num = proto; | 2809 | po->num = proto; |
2810 | po->prot_hook.type = proto; | 2810 | po->prot_hook.type = proto; |
2811 | |||
2812 | if (po->prot_hook.dev) | ||
2813 | dev_put(po->prot_hook.dev); | ||
2814 | |||
2815 | po->prot_hook.dev = dev; | 2811 | po->prot_hook.dev = dev; |
2816 | 2812 | ||
2817 | po->ifindex = dev ? dev->ifindex : 0; | 2813 | po->ifindex = dev ? dev->ifindex : 0; |
2818 | packet_cached_dev_assign(po, dev); | 2814 | packet_cached_dev_assign(po, dev); |
2819 | } | 2815 | } |
2816 | if (dev_curr) | ||
2817 | dev_put(dev_curr); | ||
2820 | 2818 | ||
2821 | if (proto == 0 || !need_rehook) | 2819 | if (proto == 0 || !need_rehook) |
2822 | goto out_unlock; | 2820 | goto out_unlock; |