]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: sgi: ioc3-eth: protect emcr in all cases
authorThomas Bogendoerfer <tbogendoerfer@suse.de>
Fri, 30 Aug 2019 09:25:37 +0000 (11:25 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 30 Aug 2019 20:54:36 +0000 (13:54 -0700)
emcr in private struct wasn't always protected by spinlock.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sgi/ioc3-eth.c

index 971986433d4c56f92d7d1d34503a5f4def996c2d..963ed0f9787ce0e62e965ca8074ff7ff93915e1c 100644 (file)
@@ -729,6 +729,8 @@ static inline void ioc3_setup_duplex(struct ioc3_private *ip)
 {
        struct ioc3_ethregs *regs = ip->regs;
 
+       spin_lock_irq(&ip->ioc3_lock);
+
        if (ip->mii.full_duplex) {
                writel(ETCSR_FD, &regs->etcsr);
                ip->emcr |= EMCR_DUPLEX;
@@ -737,6 +739,8 @@ static inline void ioc3_setup_duplex(struct ioc3_private *ip)
                ip->emcr &= ~EMCR_DUPLEX;
        }
        writel(ip->emcr, &regs->emcr);
+
+       spin_unlock_irq(&ip->ioc3_lock);
 }
 
 static void ioc3_timer(struct timer_list *t)
@@ -1625,6 +1629,8 @@ static void ioc3_set_multicast_list(struct net_device *dev)
 
        netif_stop_queue(dev);                          /* Lock out others. */
 
+       spin_lock_irq(&ip->ioc3_lock);
+
        if (dev->flags & IFF_PROMISC) {                 /* Set promiscuous.  */
                ip->emcr |= EMCR_PROMISC;
                writel(ip->emcr, &regs->emcr);
@@ -1653,6 +1659,8 @@ static void ioc3_set_multicast_list(struct net_device *dev)
                writel(ip->ehar_l, &regs->ehar_l);
        }
 
+       spin_unlock_irq(&ip->ioc3_lock);
+
        netif_wake_queue(dev);                  /* Let us get going again. */
 }