]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: bcm_sf2: Fix race condition while unmasking interrupts
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 24 Aug 2016 18:01:20 +0000 (11:01 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 25 Aug 2016 23:49:25 +0000 (16:49 -0700)
commitdb736c278dd03a3875fd637a5ce3269eb4732f5d
tree938e99cbf03a2a6c1ccda65b15db0fecd9b643d3
parent88904bd25250d94cb86b4847a7db24d98462c9b5
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: a308ff9e14d2 ("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>
drivers/net/dsa/bcm_sf2.h