HIGH Introduced in 6.15
wangxun PtPTxTimestamp UAF
CVE-2026-98562
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
01Description
In the Linux kernel, the following vulnerability has been resolved: net: libwx: fix races in Tx timestamp handling wx->ptp_tx_skb is shared between the Tx path, the PTP auxiliary worker and the timestamp cleanup paths. The WX_STATE_PTP_TX_IN_PROGRESS bit prevents multiple Tx paths from submitting timestamp requests, but does not serialize the worker against cleanup. As a result, wx_ptp_clear_tx_timestamp() can free an skb after wx_ptp_tx_hwtstamp_work() has obtained its pointer. The worker may then pass the freed skb to skb_tstamp_tx() and release the same reference again. The cleanup path may also clear the in-progress bit while the worker is still processing the old skb. This allows the Tx path to publish a new skb which the worker can subsequently overwrite with NULL, leaking its reference. Add a dedicated spinlock to protect publication and consumption of the Tx timestamp skb. Detach the skb and clear the in-progress bit while holding the lock, then deliver the timestamp and release the skb after dropping it. Use the same locked cleanup in the quiesce path, but keep the detach there free of register accesses: quiesce runs during PCIe error recovery, where MMIO is not reliable, and it deliberately did not touch the device before. The lock is taken with interrupts disabled, because netpoll can call ndo_start_xmit() with hard interrupts already off. When handling a Tx DMA mapping failure, keep the transmit path reference until after comparing the skb under the lock. This prevents skb address reuse from making the error path mistake a newer timestamp request for the failed one.
02KernelScan AI Analysis
Risk summary
A local attacker with access to a Wangxun NIC can trigger a use-after-free and double-free in the kernel's PTP Tx timestamp handling by racing packet transmission against timestamp cleanup. Successful exploitation allows arbitrary kernel memory read and write, leading to privilege escalation or kernel crash. Systems with Wangxun NICs (ngbe/txgbe drivers) running kernel 6.15 through 7.2.8 are affected.
Vulnerability analysis
The Wangxun driver's PTP Tx timestamp state (wx->ptp_tx_skb) is shared between the transmit path, a PTP auxiliary worker thread, and timestamp cleanup paths. A single state bit (WX_STATE_PTP_TX_IN_PROGRESS) prevents concurrent Tx submissions but does not serialize the worker against cleanup. This allows the cleanup path to free an skb after the worker has already read its pointer, causing the worker to pass a freed skb to skb_tstamp_tx() and release the reference a second time (double-free). Conversely, the cleanup path can clear the in-progress bit while the worker is still processing, letting a new Tx request publish a replacement skb that the worker then overwrites with NULL, leaking the new skb's reference. The fix introduces a dedicated spinlock (ptp_tx_lock) taken with interrupts disabled to protect all publication, consumption, and cleanup of the Tx timestamp skb. The skb is detached and the in-progress bit cleared atomically under the lock; timestamp delivery and skb release occur after the lock is dropped. The same locked cleanup is used in the PCIe quiesce path, but without register accesses since MMIO is unreliable during error recovery. In the Tx DMA mapping failure path, the transmit reference is retained until after the skb comparison under the lock, preventing address reuse from causing the error path to cancel a newer request. The vulnerability is reachable by any local user who can transmit packets with hardware timestamping enabled (SO_TIMESTAMPING) on a Wangxun interface; enabling PTP on the interface requires CAP_NET_ADMIN, but the race itself is triggered by ordinary packet transmission.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 7.2 | 6.15 | 7.2.9 | e78b95cfd5df |
| mainline | 6.15 | 7.3 | 3173cba11701 |