Skip to contentSkip to conversation

CVE-2025-40347: net: enetc: fix the deadlock of enetc_mdio_lock

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Dec 16, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

net: enetc: fix the deadlock of enetc_mdio_lock

After applying the workaround for err050089, the LS1028A platform experiences RCU stalls on RT kernel. This issue is caused by the recursive acquisition of the read lock enetc_mdio_lock. Here list some of the call stacks identified under the enetc_poll path that may lead to a deadlock:

enetc_poll
-> enetc_lock_mdio
-> enetc_clean_rx_ring OR napi_complete_done

     -> napi_gro_receive
        -> enetc_start_xmit
           -> enetc_lock_mdio
           -> enetc_map_tx_buffs
           -> enetc_unlock_mdio

-> enetc_unlock_mdio

After enetc_poll acquires the read lock, a higher-priority writer attempts to acquire the lock, causing preemption. The writer detects that a read lock is already held and is scheduled out. However, readers under enetc_poll cannot acquire the read lock again because a writer is already waiting, leading to a thread hang.

Currently, the deadlock is avoided by adjusting enetc_lock_mdio to prevent recursive lock acquisition.

The Linux kernel CVE team has assigned CVE-2025-40347 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.12 with commit 6d36ecdbc4410e61a0e02adc5d3abeee22a8ffd3 and fixed in 6.6.115 with commit 2781ca82ce8cad263d80b617addb727e6a84c9e5
	Issue introduced in 5.12 with commit 6d36ecdbc4410e61a0e02adc5d3abeee22a8ffd3 and fixed in 6.12.56 with commit 1f92f5bd057a4fad9dab6af17963cdd21e5da6ed
	Issue introduced in 5.12 with commit 6d36ecdbc4410e61a0e02adc5d3abeee22a8ffd3 and fixed in 6.17.6 with commit 2e55a49dc3b2a6b23329e4fbbd8a5feb20e220aa
	Issue introduced in 5.12 with commit 6d36ecdbc4410e61a0e02adc5d3abeee22a8ffd3 and fixed in 6.18 with commit 50bd33f6b3922a6b760aa30d409cae891cec8fb5
	Issue introduced in 5.10.24 with commit bf9c564716a13dde6a990d3b02c27cd6e39608bf
	Issue introduced in 5.11.7 with commit ff966263f5f9fdf9740f03fed0762ce73c230a6a

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2025-40347

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
drivers/net/ethernet/freescale/enetc/enetc.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/2781ca82ce8cad263d80b617addb727e6a84c9e5
	https://git.kernel.org/stable/c/1f92f5bd057a4fad9dab6af17963cdd21e5da6ed
	https://git.kernel.org/stable/c/2e55a49dc3b2a6b23329e4fbbd8a5feb20e220aa
	https://git.kernel.org/stable/c/50bd33f6b3922a6b760aa30d409cae891cec8fb5