aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/fpga/tests/fpga-mgr-test.c
diff options
context:
space:
mode:
authorAlexander Sverdlin <[email protected]>2025-03-31 16:36:40 +0000
committerWilliam Breathitt Gray <[email protected]>2025-05-02 23:45:11 +0000
commit7351312632e831e51383f48957d47712fae791ef (patch)
treec3b4418c12591b387d792e645c87a6d3bdbf65d8 /drivers/fpga/tests/fpga-mgr-test.c
parentLinux 6.15-rc4 (diff)
downloadkernel-7351312632e831e51383f48957d47712fae791ef.tar.gz
kernel-7351312632e831e51383f48957d47712fae791ef.zip
counter: interrupt-cnt: Protect enable/disable OPs with mutex
Enable/disable seems to be racy on SMP, consider the following scenario: CPU0 CPU1 interrupt_cnt_enable_write(true) { if (priv->enabled == enable) return 0; if (enable) { priv->enabled = true; interrupt_cnt_enable_write(false) { if (priv->enabled == enable) return 0; if (enable) { priv->enabled = true; enable_irq(priv->irq); } else { disable_irq(priv->irq) priv->enabled = false; } enable_irq(priv->irq); } else { disable_irq(priv->irq); priv->enabled = false; } The above would result in priv->enabled == false, but IRQ left enabled. Protect both write (above race) and read (to propagate the value on SMP) callbacks with a mutex. Signed-off-by: Alexander Sverdlin <[email protected]> Fixes: a55ebd47f21f ("counter: add IRQ or GPIO based counter") Acked-by: Oleksij Rempel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: William Breathitt Gray <[email protected]>
Diffstat (limited to 'drivers/fpga/tests/fpga-mgr-test.c')
0 files changed, 0 insertions, 0 deletions