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 ...@@ -1368,8 +1368,13 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void
struct packet_opt *po = pkt_sk(sk); struct packet_opt *po = pkt_sk(sk);
switch (msg) { switch (msg) {
case NETDEV_DOWN:
case NETDEV_UNREGISTER: 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) { if (dev->ifindex == po->ifindex) {
spin_lock(&po->bind_lock); spin_lock(&po->bind_lock);
if (po->running) { if (po->running) {
...@@ -1386,10 +1391,6 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void ...@@ -1386,10 +1391,6 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void
} }
spin_unlock(&po->bind_lock); spin_unlock(&po->bind_lock);
} }
#ifdef CONFIG_PACKET_MULTICAST
if (po->mclist)
packet_dev_mclist(dev, po->mclist, -1);
#endif
break; break;
case NETDEV_UP: case NETDEV_UP:
spin_lock(&po->bind_lock); spin_lock(&po->bind_lock);
...@@ -1400,10 +1401,6 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void ...@@ -1400,10 +1401,6 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void
po->running = 1; po->running = 1;
} }
spin_unlock(&po->bind_lock); spin_unlock(&po->bind_lock);
#ifdef CONFIG_PACKET_MULTICAST
if (po->mclist)
packet_dev_mclist(dev, po->mclist, +1);
#endif
break; 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