Skip to main content

CVE-2024-49998: Vulnerability in Linux Linux

High
VulnerabilityCVE-2024-49998cvecve-2024-49998
Published: Mon Oct 21 2024 (10/21/2024, 18:02:38 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: net: dsa: improve shutdown sequence Alexander Sverdlin presents 2 problems during shutdown with the lan9303 driver. One is specific to lan9303 and the other just happens to reproduce there. The first problem is that lan9303 is unique among DSA drivers in that it calls dev_get_drvdata() at "arbitrary runtime" (not probe, not shutdown, not remove): phy_state_machine() -> ... -> dsa_user_phy_read() -> ds->ops->phy_read() -> lan9303_phy_read() -> chip->ops->phy_read() -> lan9303_mdio_phy_read() -> dev_get_drvdata() But we never stop the phy_state_machine(), so it may continue to run after dsa_switch_shutdown(). Our common pattern in all DSA drivers is to set drvdata to NULL to suppress the remove() method that may come afterwards. But in this case it will result in an NPD. The second problem is that the way in which we set dp->conduit->dsa_ptr = NULL; is concurrent with receive packet processing. dsa_switch_rcv() checks once whether dev->dsa_ptr is NULL, but afterwards, rather than continuing to use that non-NULL value, dev->dsa_ptr is dereferenced again and again without NULL checks: dsa_conduit_find_user() and many other places. In between dereferences, there is no locking to ensure that what was valid once continues to be valid. Both problems have the common aspect that closing the conduit interface solves them. In the first case, dev_close(conduit) triggers the NETDEV_GOING_DOWN event in dsa_user_netdevice_event() which closes user ports as well. dsa_port_disable_rt() calls phylink_stop(), which synchronously stops the phylink state machine, and ds->ops->phy_read() will thus no longer call into the driver after this point. In the second case, dev_close(conduit) should do this, as per Documentation/networking/driver.rst: | Quiescence | ---------- | | After the ndo_stop routine has been called, the hardware must | not receive or transmit any data. All in flight packets must | be aborted. If necessary, poll or wait for completion of | any reset commands. So it should be sufficient to ensure that later, when we zeroize conduit->dsa_ptr, there will be no concurrent dsa_switch_rcv() call on this conduit. The addition of the netif_device_detach() function is to ensure that ioctls, rtnetlinks and ethtool requests on the user ports no longer propagate down to the driver - we're no longer prepared to handle them. The race condition actually did not exist when commit 0650bf52b31f ("net: dsa: be compatible with masters which unregister on shutdown") first introduced dsa_switch_shutdown(). It was created later, when we stopped unregistering the user interfaces from a bad spot, and we just replaced that sequence with a racy zeroization of conduit->dsa_ptr (one which doesn't ensure that the interfaces aren't up).

AI-Powered Analysis

AILast updated: 06/27/2025, 21:42:26 UTC

Technical Analysis

CVE-2024-49998 is a vulnerability in the Linux kernel's Distributed Switch Architecture (DSA) subsystem, specifically affecting the lan9303 driver. The issue arises during the shutdown sequence of network devices managed by this driver. Two primary problems are identified: first, the lan9303 driver uniquely calls dev_get_drvdata() at arbitrary runtime moments outside the typical probe, shutdown, or remove phases, particularly within the phy_state_machine() context. This state machine continues running after dsa_switch_shutdown(), leading to potential use-after-free or null pointer dereference (NPD) scenarios because the driver data pointer (drvdata) is set to NULL to suppress remove() calls, but the phy_state_machine() may still invoke driver callbacks. Second, there is a race condition involving the conduit interface's dsa_ptr pointer. During shutdown, dsa_ptr is set to NULL concurrently with packet reception processing (dsa_switch_rcv()), which dereferences dsa_ptr multiple times without proper locking or NULL checks after the initial verification. This can cause invalid memory accesses or crashes. The root cause is a timing and synchronization flaw in the shutdown sequence, exacerbated by changes in how user interfaces are unregistered. The fix involves ensuring that dev_close(conduit) is called to trigger NETDEV_GOING_DOWN events, stopping the phylink state machine synchronously, and detaching the network interface to prevent further ioctl or ethtool requests. This ensures no driver callbacks occur after shutdown and that no concurrent access to dsa_ptr happens. The vulnerability does not have known exploits in the wild and affects specific Linux kernel versions identified by commit hashes. It is a subtle kernel race condition and use-after-free type flaw in network device driver shutdown handling.

Potential Impact

For European organizations relying on Linux systems with the lan9303 DSA driver—commonly used in embedded systems, industrial networking equipment, or specialized network appliances—this vulnerability could lead to kernel crashes or denial of service during device shutdown sequences. While it does not directly enable code execution or privilege escalation, the resulting instability could disrupt critical network infrastructure, especially in environments where network devices are frequently restarted or reconfigured. This could impact availability of network services, potentially affecting industrial control systems, telecommunications infrastructure, or data center networking equipment. Given the kernel-level nature of the flaw, exploitation could also be leveraged as part of a more complex attack chain to degrade system reliability or cause targeted disruptions. The lack of known exploits reduces immediate risk, but the vulnerability's presence in the Linux kernel means that any European organization using affected kernel versions in critical network roles should consider it a significant operational risk.

Mitigation Recommendations

European organizations should ensure that all Linux systems, especially those running network devices with the lan9303 DSA driver, are updated to the latest kernel versions where this vulnerability is patched. Specifically, they should: 1) Apply kernel updates that include the fix for CVE-2024-49998 as soon as they become available from their Linux distribution vendors or kernel maintainers. 2) Audit network device shutdown procedures to confirm that dev_close(conduit) is properly invoked, ensuring the phylink state machine is stopped synchronously and that interfaces are detached to prevent concurrent access issues. 3) Implement monitoring for kernel crashes or unusual network device behavior that could indicate attempts to trigger this race condition. 4) For embedded or custom Linux deployments, review and test the shutdown sequence of DSA drivers to verify correct synchronization and absence of race conditions. 5) Engage with hardware vendors to confirm that firmware and drivers are updated accordingly. 6) Consider isolating critical network devices or applying additional network segmentation to limit the impact of potential denial-of-service conditions caused by this vulnerability.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-10-21T12:17:06.057Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9820c4522896dcbdcee0

Added to database: 5/21/2025, 9:08:48 AM

Last enriched: 6/27/2025, 9:42:26 PM

Last updated: 7/29/2025, 7:44:07 PM

Views: 16

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats