diff options
author | Timo Schlüßler <schluessler@krause.de> | 2019-10-11 16:38:19 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-05 11:19:43 +0300 |
commit | 7302e7b10855e8512d406e2cb32916c71edb8936 (patch) | |
tree | 85970634550c91207efdc410137a6091f148b44b /drivers/net/can/spi | |
parent | 24e10fc2e0db64a87853f868f5c8dafac469ec8a (diff) | |
download | linux-7302e7b10855e8512d406e2cb32916c71edb8936.tar.xz |
can: mcp251x: mcp251x_restart_work_handler(): Fix potential force_quit race condition
[ Upstream commit 27a0e54bae09d2dd023a01254db506d61cc50ba1 ]
In mcp251x_restart_work_handler() the variable to stop the interrupt
handler (priv->force_quit) is reset after the chip is restarted and thus
a interrupt might occur.
This patch fixes the potential race condition by resetting force_quit
before enabling interrupts.
Signed-off-by: Timo Schlüßler <schluessler@krause.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net/can/spi')
-rw-r--r-- | drivers/net/can/spi/mcp251x.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c index de8d9dceb123..0b0dd3f096dc 100644 --- a/drivers/net/can/spi/mcp251x.c +++ b/drivers/net/can/spi/mcp251x.c @@ -773,6 +773,7 @@ static void mcp251x_restart_work_handler(struct work_struct *ws) if (priv->after_suspend) { mcp251x_hw_reset(spi); mcp251x_setup(net, spi); + priv->force_quit = 0; if (priv->after_suspend & AFTER_SUSPEND_RESTART) { mcp251x_set_normal_mode(spi); } else if (priv->after_suspend & AFTER_SUSPEND_UP) { @@ -784,7 +785,6 @@ static void mcp251x_restart_work_handler(struct work_struct *ws) mcp251x_hw_sleep(spi); } priv->after_suspend = 0; - priv->force_quit = 0; } if (priv->restart_tx) { |