Skip to content

Commit 2490695

Browse files
ndosschegregkh
authored andcommitted
sfc: extend the locking on mcdi->seqno
[ Upstream commit f1fb205 ] 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>
1 parent 2fad5b6 commit 2490695

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • drivers/net/ethernet/sfc

drivers/net/ethernet/sfc/mcdi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
163163
/* Serialise with efx_mcdi_ev_cpl() and efx_mcdi_ev_death() */
164164
spin_lock_bh(&mcdi->iface_lock);
165165
++mcdi->seqno;
166+
seqno = mcdi->seqno & SEQ_MASK;
166167
spin_unlock_bh(&mcdi->iface_lock);
167168

168-
seqno = mcdi->seqno & SEQ_MASK;
169169
xflags = 0;
170170
if (mcdi->mode == MCDI_MODE_EVENTS)
171171
xflags |= MCDI_HEADER_XFLAGS_EVREQ;

0 commit comments

Comments
 (0)