{"answers":{"affected":"","exploited":"There is no known exploitation of CVE-2025-40209 in the wild and no public exploit code.","fix":"Apply the vendor's patch.","what":"CVE-2025-40209 is a memory corruption vulnerability in Linux, published on 21 Nov 2025. It can only be exploited from the same machine or local network, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2025-40209 and fix it if it is affected.\n\nWhat it is: CVE-2025-40209 is a memory corruption vulnerability in Linux, published on 21 Nov 2025. It can only be exploited from the same machine or local network, with no action from the victim.\nExploitation: There is no known exploitation of CVE-2025-40209 in the wild and no public exploit code.\n\nAffected product: Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2025-40209/ (Markdown: https://insights.sbomify.com/CVE-2025-40209/index.md)","id":"CVE-2025-40209","markdown":"https://insights.sbomify.com/CVE-2025-40209/index.md","name":"CVE-2025-40209","record":{"aliases":["BELL-CVE-2025-40209","DEBIAN-CVE-2025-40209","GHSA-2833-8jvf-3588","ROOT-OS-DEBIAN-13-CVE-2025-40209","UBUNTU-CVE-2025-40209"],"analysis":{"component_type":"kernel","fix_type":"patch","impacts":["denial_of_service"],"network_reachable":"adjacent_or_local","non_default_config":false,"product_category":"Linux kernel","requires_auth":"low_privilege","summary":"An unprivileged user can cause a kernel memory leak in btrfs by triggering invalid qgroup relations, potentially leading to denial of service.","user_interaction":"not_required","vuln_class":"memory_corruption"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"Linux","cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: fix memory leak of qgroup_list in btrfs_add_qgroup_relation\n\nWhen btrfs_add_qgroup_relation() is called with invalid qgroup levels\n(src \u003e= dst), the function returns -EINVAL directly without freeing the\npreallocated qgroup_list structure passed by the caller. This causes a\nmemory leak because the caller unconditionally sets the pointer to NULL\nafter the call, preventing any cleanup.\n\nThe issue occurs because the level validation check happens before the\nmutex is acquired and before any error handling path that would free\nthe prealloc pointer. On this early return, the cleanup code at the\n'out' label (which includes kfree(prealloc)) is never reached.\n\nIn btrfs_ioctl_qgroup_assign(), the code pattern is:\n\n    prealloc = kzalloc(sizeof(*prealloc), GFP_KERNEL);\n    ret = btrfs_add_qgroup_relation(trans, sa-\u003esrc, sa-\u003edst, prealloc);\n    prealloc = NULL;  // Always set to NULL regardless of return value\n    ...\n    kfree(prealloc);  // This becomes kfree(NULL), does nothing\n\nWhen the level check fails, 'prealloc' is never freed by either the\ncallee or the caller, resulting in a 64-byte memory leak per failed\noperation. This can be triggered repeatedly by an unprivileged user\nwith access to a writable btrfs mount, potentially exhausting kernel\nmemory.\n\nFix this by freeing prealloc before the early return, ensuring prealloc\nis always freed on all error paths.","ecosystems":[],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"btrfs: fix memory leak of qgroup_list in btrfs_add_qgroup_relation","id":"CVE-2025-40209","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":null,"product":null,"products":[],"type":"memory_corruption","year":"2025"},"n_packages":0,"n_references":3,"next":{"headline":"Revert \"NFSD: Remove the cap on number of operations per NFSv4 COMPOUND\"","id":"CVE-2025-40210"},"packages":[],"prev":{"headline":"media: iris: fix module removal if firmware download failed","id":"CVE-2025-40208"},"products":["Linux"],"published":"2025-11-21","related":[],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":"PUBLISHED","updated":"2026-05-11","vendors":["Linux"]},"summary":"An unprivileged user can cause a kernel memory leak in btrfs by triggering invalid qgroup relations, potentially leading to denial of service.","url":"https://insights.sbomify.com/CVE-2025-40209/"}