[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190828140315.17048-15-tbogendoerfer@suse.de>
Date: Wed, 28 Aug 2019 16:03:13 +0200
From: Thomas Bogendoerfer <tbogendoerfer@...e.de>
To: Ralf Baechle <ralf@...ux-mips.org>,
Paul Burton <paul.burton@...s.com>,
James Hogan <jhogan@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org
Subject: [PATCH net-next 14/15] net: sgi: ioc3-eth: protect emcr in all cases
emcr in private struct wasn't always protected by spinlock.
Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@...e.de>
---
drivers/net/ethernet/sgi/ioc3-eth.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c
index b8aea19fbeba..5de8300e5eb2 100644
--- a/drivers/net/ethernet/sgi/ioc3-eth.c
+++ b/drivers/net/ethernet/sgi/ioc3-eth.c
@@ -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, ®s->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, ®s->emcr);
+
+ spin_unlock_irq(&ip->ioc3_lock);
}
static void ioc3_timer(struct timer_list *t)
@@ -1627,6 +1631,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, ®s->emcr);
@@ -1655,6 +1661,8 @@ static void ioc3_set_multicast_list(struct net_device *dev)
writel(ip->ehar_l, ®s->ehar_l);
}
+ spin_unlock_irq(&ip->ioc3_lock);
+
netif_wake_queue(dev); /* Let us get going again. */
}
--
2.13.7
Powered by blists - more mailing lists