{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2023-54238",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2025-12-30T12:06:44.508Z",
        "datePublished": "2025-12-30T12:11:27.702Z",
        "dateUpdated": "2026-08-05T09:18:19.166Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-05T09:18:19.166Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nmlx5: fix skb leak while fifo resync and push\n\nDuring ptp resync operation SKBs were poped from the fifo but were never\nfreed neither by napi_consume nor by dev_kfree_skb_any. Add call to\nnapi_consume_skb to properly free SKBs.\n\nAnother leak was happening because mlx5e_skb_fifo_has_room() had an error\nin the check. Comparing free running counters works well unless C promotes\nthe types to something wider than the counter. In this case counters are\nu16 but the result of the substraction is promouted to int and it causes\nwrong result (negative value) of the check when producer have already\noverlapped but consumer haven't yet. Explicit cast to u16 fixes the issue."
                }
            ],
            "metrics": [
                {
                    "cvssV3_1": {
                        "version": "3.1",
                        "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
                        "baseScore": 7.8,
                        "baseSeverity": "HIGH"
                    },
                    "scenarios": [
                        {
                            "lang": "en",
                            "value": "AV:L - The defect is in the mlx5 PTP transmit/completion path, reached by locally originated packets — an unprivileged process opening a UDP socket, enabling SO_TIMESTAMPING with SOF_TIMESTAMPING_TX_HARDWARE, and sending to port 319 (or ethertype 0x88F7). A remote peer cannot set SKBTX_HW_TSTAMP on the host's outbound skbs, so the reliable trigger is a local syscall path, not received network data.\nAC:L - Both preconditions are entirely under the attacker's control: the u16 producer counter is advanced by the attacker's own packets, so wrapping into the broken-comparison window is deterministic after ~65536 sends, and outrunning the slower port-timestamp CQ is achieved by simply bursting traffic. No race the attacker cannot drive, no unpredictable memory layout, and the enabling tx_port_ts priv-flag is a routine runtime setting in PTP-timestamping deployments rather than a rare build option.\nPR:L - Neither setsockopt(SO_TIMESTAMPING) with SOF_TIMESTAMPING_TX_HARDWARE nor sending UDP to port 319 requires any capability, and mlx5e_use_ptpsq() checks only the skb tx_flags and packet classification — no hwtstamp or privilege gate. Any unprivileged local account can therefore drive skbs onto the PTP SQ and overflow the fifo.\nUI:N - The attacker's own packet transmission drives the fifo overflow and the corrupted TS-CQE consumption entirely; no action by any other user or administrator is needed once the interface is in its normal PTP configuration.\nS:U - The corruption is confined to kernel heap objects (sk_buff slab entries and the driver's skb fifo) within the same kernel security authority. There is no crossing of a VM, IOMMU, or sandbox boundary.\nC:H - Duplicate pops make the TS-CQ path dereference already-freed sk_buffs — mlx5e_skb_cb_get_hwts() reads freed slab memory and skb_tstamp_tx() clones the freed (and possibly reallocated) skb and delivers it to a socket's error queue, exposing kernel heap contents to userspace. The premature-free primitive is also the classic basis for a controlled arbitrary-read via heap spraying.\nI:H - The same duplicate consumption causes skb refcount underflow and double free of a kmem_cache object, corrupting the slab freelist, while mlx5e_skb_cb_hwtstamp_handler() writes hwtstamp values and memsets into the freed object's cb field. That combination of double-free plus write-into-freed-memory is a heap corruption primitive usable for control-flow hijack.\nA:H - The overflow reliably produces kernel oopses in softirq/NAPI context — NULL dereference on never-written kvzalloc'd fifo slots during the resync loop, WARN_ON_ONCE in mlx5e_skb_fifo_pop() (fatal under panic_on_warn), and double-free BUGs — taking down the machine. Independently, the unfreed skbs in the resync path leak memory without bound until OOM."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c",
                        "drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h"
                    ],
                    "versions": [
                        {
                            "version": "58a518948f60153e8f6cb8361d2712aa3a1af94a",
                            "lessThan": "234cffda95e1049f58e8ec136ef105c633f0ed19",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "58a518948f60153e8f6cb8361d2712aa3a1af94a",
                            "lessThan": "68504c66d08c70fb92799722e25a932d311d74fd",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "58a518948f60153e8f6cb8361d2712aa3a1af94a",
                            "lessThan": "e435941b1da1a0be4ff8a7ae425774c76a5ac514",
                            "status": "affected",
                            "versionType": "git"
                        }
                    ]
                },
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "affected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c",
                        "drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h"
                    ],
                    "versions": [
                        {
                            "version": "6.0",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "6.0",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.1.18",
                            "lessThanOrEqual": "6.1.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.2.5",
                            "lessThanOrEqual": "6.2.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.3",
                            "lessThanOrEqual": "*",
                            "status": "unaffected",
                            "versionType": "original_commit_for_fix"
                        }
                    ]
                }
            ],
            "cpeApplicability": [
                {
                    "nodes": [
                        {
                            "operator": "OR",
                            "negate": false,
                            "cpeMatch": [
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.0",
                                    "versionEndExcluding": "6.1.18"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.0",
                                    "versionEndExcluding": "6.2.5"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.0",
                                    "versionEndExcluding": "6.3"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/234cffda95e1049f58e8ec136ef105c633f0ed19"
                },
                {
                    "url": "https://git.kernel.org/stable/c/68504c66d08c70fb92799722e25a932d311d74fd"
                },
                {
                    "url": "https://git.kernel.org/stable/c/e435941b1da1a0be4ff8a7ae425774c76a5ac514"
                }
            ],
            "title": "mlx5: fix skb leak while fifo resync and push",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        }
    }
}