mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
net: lan743x: Initialize eth_syslock spinlock before use
commit39139b1c1cupstream. lan743x_hardware_init() calls pci11x1x_strap_get_status() during the PCI11x1x probe sequence. That helper acquires the Ethernet subsystem hardware lock via lan743x_hs_syslock_acquire(), which relies on adapter->eth_syslock_spinlock to serialize access. The spinlock is currently initialized only after the strap status is read. With CONFIG_DEBUG_SPINLOCK enabled, taking the zeroed initialized spinlock can trip the spinlock debug check. Fix by initializing adapter->eth_syslock_spinlock before reading the strap status so the probe path never attempts to lock an uninitialized spinlock. Fixes:46b777ad9a("net: lan743x: Add support to SGMII 1G and 2.5G") Cc: stable@vger.kernel.org # v6.0+ Signed-off-by: Andrea Righi <arighi@nvidia.com> Reviewed-by: David Thompson <davthompson@nvidia.com> Reviewed-by: Thangaraj Samynathan<Thangaraj.s@microchip.com> Link: https://patch.msgid.link/20260626163218.3591486-1-arighi@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ffb13fe194
commit
6523daa685
@@ -3299,8 +3299,8 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
|
||||
adapter->max_tx_channels = PCI11X1X_MAX_TX_CHANNELS;
|
||||
adapter->used_tx_channels = PCI11X1X_USED_TX_CHANNELS;
|
||||
adapter->max_vector_count = PCI11X1X_MAX_VECTOR_COUNT;
|
||||
pci11x1x_strap_get_status(adapter);
|
||||
spin_lock_init(&adapter->eth_syslock_spinlock);
|
||||
pci11x1x_strap_get_status(adapter);
|
||||
mutex_init(&adapter->sgmii_rw_lock);
|
||||
pci11x1x_set_rfe_rd_fifo_threshold(adapter);
|
||||
sgmii_ctl = lan743x_csr_read(adapter, SGMII_CTL);
|
||||
|
||||
Reference in New Issue
Block a user