{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2024-50059",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2024-10-21T19:36:19.939Z",
        "datePublished": "2024-10-21T19:39:49.079Z",
        "dateUpdated": "2026-08-05T11:41:18.294Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-05T11:41:18.294Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nntb: ntb_hw_switchtec: Fix use after free vulnerability in switchtec_ntb_remove due to race condition\n\nIn the switchtec_ntb_add function, it can call switchtec_ntb_init_sndev\nfunction, then &sndev->check_link_status_work is bound with\ncheck_link_status_work. switchtec_ntb_link_notification may be called\nto start the work.\n\nIf we remove the module which will call switchtec_ntb_remove to make\ncleanup, it will free sndev through kfree(sndev), while the work\nmentioned above will be used. The sequence of operations that may lead\nto a UAF bug is as follows:\n\nCPU0                                 CPU1\n\n                        | check_link_status_work\nswitchtec_ntb_remove    |\nkfree(sndev);           |\n                        | if (sndev->link_force_down)\n                        | // use sndev\n\nFix it by ensuring that the work is canceled before proceeding with\nthe cleanup in switchtec_ntb_remove."
                }
            ],
            "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 freeing side of the race is driver teardown, entered only through local actions — `rmmod ntb_hw_switchtec`, a write to `/sys/bus/pci/drivers/switchtec/unbind`, or `/sys/bus/pci/devices/.../remove` — and the racing side arrives over the PCIe/NTB fabric rather than a network stack. No network or adjacent-network protocol reaches this code, so local system access is the entry point.\nAC:L - The attacker controls both sides: the NTB peer host (or a local user driving the Switchtec management device) can send `LINK_MESSAGE`/`MSG_LINK_FORCE_DOWN` continuously so `check_link_status_work` is always pending, and `switchtec_ntb_part_op()` then sleeps up to 1000×50 ms inside the object, holding the window open for tens of seconds while teardown is triggered. Bind/unbind can also be repeated indefinitely, so success depends on nothing outside the attacker's influence.\nPR:L - The side that keeps the work item live requires no privilege — it is driven by the NTB peer host's link messages, by PCIe link-state events, or by non-CAP_SYS_ADMIN MRPC commands on `/dev/switchtecN` (the driver explicitly gates only GAS read/write on CAP_SYS_ADMIN) — while the `kfree()` occurs on any device removal, including surprise PCIe hot-remove and routine administrative unbind. Consistent with the scoring of the equivalent driver remove-path work-item UAFs (e.g. CVE-2024-57984), low local privileges are the defensible assumption.\nUI:N - The removal and the link-message traffic are both initiated by the attacker or generated autonomously by the PCIe hardware; no victim must mount a filesystem, open a file, or take any other action. Exploitation completes entirely from the attacker's own operations.\nS:U - The use-after-free corrupts kernel heap state and is exploited within the same kernel security authority that owns the driver. No hypervisor, IOMMU, or sandbox boundary is crossed by the vulnerability itself.\nC:H - After `kfree(sndev)` the worker reads `link_force_down`, `mmio_ntb`, `mmio_peer_ctrl`, `mmio_peer_dbmsg`, `self_shared_dma`, `peer_direct_mw_to_bar[]` and `stdev->dev` back out of freed memory, and the ~50-second sleep inside `switchtec_ntb_part_op()` makes slab reclaim by an attacker-sprayed object highly practical, converting the dangling object into a controlled kernel read primitive. Per use-after-free scoring guidance this is High.\nI:H - `ntb_link_event()` performs `ntb->ctx_ops->link_event(ntb->ctx)` — an indirect branch through a function pointer read from freed memory — and `config_rsvd_lut_win()` issues `iowrite32`/`iowrite64` to `&ctl->bar_entry[peer_bar]`/`&ctl->lut_entry[]` with base pointer, index and payload all taken from the freed object, giving both control-flow hijack and a controlled write (including reprogramming of the NTB DMA translation window) after heap spraying.\nA:H - Even without successful exploitation, the worker takes a spinlock in freed memory, dereferences freed `__iomem` pointers and touches the device after teardown, and the concurrent `link_notifier`/`sndev` NULL stores add a NULL-pointer dereference path — any of which produces a kernel oops or panic."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "drivers/ntb/hw/mscc/ntb_hw_switchtec.c"
                    ],
                    "versions": [
                        {
                            "version": "d04be142b8b61ffb3c9cc5c6d1abda8fc59a16c9",
                            "lessThan": "5126d8f5567f49b52e21fca320eaa97977055099",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "d04be142b8b61ffb3c9cc5c6d1abda8fc59a16c9",
                            "lessThan": "b650189687822b705711f0567a65a164a314d8df",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "d04be142b8b61ffb3c9cc5c6d1abda8fc59a16c9",
                            "lessThan": "92728fceefdaa2a0a3aae675f86193b006eeaa43",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "d04be142b8b61ffb3c9cc5c6d1abda8fc59a16c9",
                            "lessThan": "3ae45be8492460a35b5aebf6acac1f1d32708946",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "d04be142b8b61ffb3c9cc5c6d1abda8fc59a16c9",
                            "lessThan": "fa840ba4bd9f3bad7f104e5b32028ee73af8b3dd",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "d04be142b8b61ffb3c9cc5c6d1abda8fc59a16c9",
                            "lessThan": "177925d9c8715a897bb79eca62628862213ba956",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "d04be142b8b61ffb3c9cc5c6d1abda8fc59a16c9",
                            "lessThan": "e51aded92d42784313ba16c12f4f88cc4f973bbb",
                            "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/ntb/hw/mscc/ntb_hw_switchtec.c"
                    ],
                    "versions": [
                        {
                            "version": "4.16",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "4.16",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.4.285",
                            "lessThanOrEqual": "5.4.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.10.227",
                            "lessThanOrEqual": "5.10.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.15.168",
                            "lessThanOrEqual": "5.15.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.1.113",
                            "lessThanOrEqual": "6.1.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.6.57",
                            "lessThanOrEqual": "6.6.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.11.4",
                            "lessThanOrEqual": "6.11.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.12",
                            "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": "4.16",
                                    "versionEndExcluding": "5.4.285"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.16",
                                    "versionEndExcluding": "5.10.227"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.16",
                                    "versionEndExcluding": "5.15.168"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.16",
                                    "versionEndExcluding": "6.1.113"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.16",
                                    "versionEndExcluding": "6.6.57"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.16",
                                    "versionEndExcluding": "6.11.4"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.16",
                                    "versionEndExcluding": "6.12"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/5126d8f5567f49b52e21fca320eaa97977055099"
                },
                {
                    "url": "https://git.kernel.org/stable/c/b650189687822b705711f0567a65a164a314d8df"
                },
                {
                    "url": "https://git.kernel.org/stable/c/92728fceefdaa2a0a3aae675f86193b006eeaa43"
                },
                {
                    "url": "https://git.kernel.org/stable/c/3ae45be8492460a35b5aebf6acac1f1d32708946"
                },
                {
                    "url": "https://git.kernel.org/stable/c/fa840ba4bd9f3bad7f104e5b32028ee73af8b3dd"
                },
                {
                    "url": "https://git.kernel.org/stable/c/177925d9c8715a897bb79eca62628862213ba956"
                },
                {
                    "url": "https://git.kernel.org/stable/c/e51aded92d42784313ba16c12f4f88cc4f973bbb"
                }
            ],
            "title": "ntb: ntb_hw_switchtec: Fix use after free vulnerability in switchtec_ntb_remove due to race condition",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        },
        "adp": [
            {
                "metrics": [
                    {
                        "other": {
                            "type": "ssvc",
                            "content": {
                                "id": "CVE-2024-50059",
                                "role": "CISA Coordinator",
                                "options": [
                                    {
                                        "Exploitation": "none"
                                    },
                                    {
                                        "Automatable": "no"
                                    },
                                    {
                                        "Technical Impact": "partial"
                                    }
                                ],
                                "version": "2.0.3",
                                "timestamp": "2024-10-22T13:23:07.094134Z"
                            }
                        }
                    }
                ],
                "title": "CISA ADP Vulnrichment",
                "providerMetadata": {
                    "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
                    "shortName": "CISA-ADP",
                    "dateUpdated": "2024-10-22T13:28:42.461Z"
                }
            },
            {
                "title": "CVE Program Container",
                "references": [
                    {
                        "url": "https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html"
                    },
                    {
                        "url": "https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html"
                    }
                ],
                "providerMetadata": {
                    "orgId": "af854a3a-2127-422b-91ae-364da2661108",
                    "shortName": "CVE",
                    "dateUpdated": "2025-11-03T22:24:58.655Z"
                }
            }
        ]
    }
}