diff options
author | Niels Dossche <dossche.niels@gmail.com> | 2022-03-01 23:28:22 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-03-19 13:48:45 +0100 |
commit | 1c30164f68c25e004a631a7bf4fbac3e2ae43596 (patch) | |
tree | 4bac4b087fdeb53ac89a9f439bf2b32b653779dd | |
parent | 09253fa62941296f0522fe72664395e3ae2445e2 (diff) | |
download | linux-stable-1c30164f68c25e004a631a7bf4fbac3e2ae43596.tar.gz linux-stable-1c30164f68c25e004a631a7bf4fbac3e2ae43596.tar.bz2 linux-stable-1c30164f68c25e004a631a7bf4fbac3e2ae43596.zip |
sfc: extend the locking on mcdi->seqno
[ Upstream commit f1fb205efb0ccca55626fd4ef38570dd16b44719 ]
seqno could be read as a stale value outside of the lock. The lock is
already acquired to protect the modification of seqno against a possible
race condition. Place the reading of this value also inside this locking
to protect it against a possible race condition.
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
Acked-by: Martin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/net/ethernet/sfc/mcdi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c index be6bfd6b7ec7..50baf62b2cbc 100644 --- a/drivers/net/ethernet/sfc/mcdi.c +++ b/drivers/net/ethernet/sfc/mcdi.c @@ -163,9 +163,9 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd, /* Serialise with efx_mcdi_ev_cpl() and efx_mcdi_ev_death() */ spin_lock_bh(&mcdi->iface_lock); ++mcdi->seqno; + seqno = mcdi->seqno & SEQ_MASK; spin_unlock_bh(&mcdi->iface_lock); - seqno = mcdi->seqno & SEQ_MASK; xflags = 0; if (mcdi->mode == MCDI_MODE_EVENTS) xflags |= MCDI_HEADER_XFLAGS_EVREQ; |