Commit 438fb92c authored by Jason Lunz's avatar Jason Lunz Committed by Hideaki Yoshifuji

[NET] Fix refcounting of dev->promiscuity for af_packet.

parent b27b7670
......@@ -1368,8 +1368,13 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void
struct packet_opt *po = pkt_sk(sk);
switch (msg) {
case NETDEV_DOWN:
case NETDEV_UNREGISTER:
#ifdef CONFIG_PACKET_MULTICAST
if (po->mclist)
packet_dev_mclist(dev, po->mclist, -1);
// fallthrough
#endif
case NETDEV_DOWN:
if (dev->ifindex == po->ifindex) {
spin_lock(&po->bind_lock);
if (po->running) {
......@@ -1386,10 +1391,6 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void
}
spin_unlock(&po->bind_lock);
}
#ifdef CONFIG_PACKET_MULTICAST
if (po->mclist)
packet_dev_mclist(dev, po->mclist, -1);
#endif
break;
case NETDEV_UP:
spin_lock(&po->bind_lock);
......@@ -1400,10 +1401,6 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void
po->running = 1;
}
spin_unlock(&po->bind_lock);
#ifdef CONFIG_PACKET_MULTICAST
if (po->mclist)
packet_dev_mclist(dev, po->mclist, +1);
#endif
break;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment