diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2016-08-24 11:01:20 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-08-25 16:49:25 -0700 |
commit | 4f101c47791cdcb831b3ef1f831b1cc51e4fe03c (patch) | |
tree | 938e99cbf03a2a6c1ccda65b15db0fecd9b643d3 /drivers/net | |
parent | 166ee5b87866de07a3e56c1b757f2b5cabba72a5 (diff) | |
download | linux-4f101c47791cdcb831b3ef1f831b1cc51e4fe03c.tar.gz linux-4f101c47791cdcb831b3ef1f831b1cc51e4fe03c.tar.bz2 linux-4f101c47791cdcb831b3ef1f831b1cc51e4fe03c.zip |
net: dsa: bcm_sf2: Fix race condition while unmasking interrupts
We kept shadow copies of which interrupt sources we have enabled and
disabled, but due to an order bug in how intrl2_mask_clear was defined,
we could run into the following scenario:
CPU0 CPU1
intrl2_1_mask_clear(..)
sets INTRL2_CPU_MASK_CLEAR
bcm_sf2_switch_1_isr
read INTRL2_CPU_STATUS and masks with stale
irq1_mask value
updates irq1_mask value
Which would make us loop again and again trying to process and interrupt
we are not clearing since our copy of whether it was enabled before
still indicates it was not. Fix this by updating the shadow copy first,
and then unasking at the HW level.
Fixes: 246d7f773c13 ("net: dsa: add Broadcom SF2 switch driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/dsa/bcm_sf2.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/dsa/bcm_sf2.h b/drivers/net/dsa/bcm_sf2.h index 463bed8cbe4c..dd446e466699 100644 --- a/drivers/net/dsa/bcm_sf2.h +++ b/drivers/net/dsa/bcm_sf2.h @@ -205,8 +205,8 @@ static inline void name##_writeq(struct bcm_sf2_priv *priv, u64 val, \ static inline void intrl2_##which##_mask_clear(struct bcm_sf2_priv *priv, \ u32 mask) \ { \ - intrl2_##which##_writel(priv, mask, INTRL2_CPU_MASK_CLEAR); \ priv->irq##which##_mask &= ~(mask); \ + intrl2_##which##_writel(priv, mask, INTRL2_CPU_MASK_CLEAR); \ } \ static inline void intrl2_##which##_mask_set(struct bcm_sf2_priv *priv, \ u32 mask) \ |