]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net: bcmgenet: avoid unbalanced enable_irq_wake calls
authorFlorian Fainelli <f.fainelli@gmail.com>
Fri, 10 Oct 2014 17:51:53 +0000 (10:51 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 10 Oct 2014 19:39:15 +0000 (15:39 -0400)
Multiple enable_irq_wake() calls will keep increasing the IRQ
wake_depth, which ultimately leads to the following types of
situation:

1) enable Wake-on-LAN interrupt w/o password
2) enable Wake-on-LAN interrupt w/ password
3) enable Wake-on-LAN interrupt w/o password
4) disable Wake-on-LAN interrupt

After step 4), GENET would always wake-up the system no matter what
wake-up device we use, which is not what we want. Fix this by making
sure there are no unbalanced enable_irq_wake() calls.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c

index b82b7e4e06b27222af1613799af7354790210294..149a0d70c10883f3f769904ef6ae2ca6b2f66f8e 100644 (file)
@@ -86,7 +86,9 @@ int bcmgenet_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
        /* Flag the device and relevant IRQ as wakeup capable */
        if (wol->wolopts) {
                device_set_wakeup_enable(kdev, 1);
-               enable_irq_wake(priv->wol_irq);
+               /* Avoid unbalanced enable_irq_wake calls */
+               if (priv->wol_irq_disabled)
+                       enable_irq_wake(priv->wol_irq);
                priv->wol_irq_disabled = false;
        } else {
                device_set_wakeup_enable(kdev, 0);