sfc: extend the locking on mcdi->seqno
Subsystems (3)
PATCH 1/1 sfc: extend the locking on mcdi->seqno
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.
--- drivers/net/ethernet/sfc/mcdi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/sfc/mcdi.c +1 -1
@@ -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 ;
Signature · 1 line
2.35.1
Quoted 6 lines · Niels Dossche
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 <[email protected]>
Quoted 21 lines
--- drivers/net/ethernet/sfc/mcdi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/sfc/mcdi.c +1
-1@@ -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 ;Signature · 1 line
2.35.1
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:
Quoted 8 lines · On Tue, 1 Mar 2022 23:28:22 +0100 you wrote:
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 <[email protected]>[...]
Here is the summary with links:
- sfc: extend the locking on mcdi->seqno
https://git.kernel.org/netdev/net/c/f1fb205efb0c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html