{"id":"CVE-2025-21842","state":"PUBLISHED","title":"amdkfd: properly free gang_ctx_bo when failed to init user queue","description":"In the Linux kernel, the following vulnerability has been resolved:\n\namdkfd: properly free gang_ctx_bo when failed to init user queue\n\nThe destructor of a gtt bo is declared as\nvoid amdgpu_amdkfd_free_gtt_mem(struct amdgpu_device *adev, void **mem_obj);\nWhich takes void** as the second parameter.\n\nGCC allows passing void* to the function because void* can be implicitly\ncasted to any other types, so it can pass compiling.\n\nHowever, passing this void* parameter into the function's\nexecution process(which expects void** and dereferencing void**)\nwill result in errors.","publishedAt":"2025-03-07T09:10:00.298Z","updatedAt":"2026-08-05T11:54:51.838Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"fb91065851cd5f2735348c5f3eddeeca3d7c2973","status":"affected","lessThan":"ae5ab1c1ae504f622cc1ff48830a9ed48428146d","versionType":"git"},{"version":"fb91065851cd5f2735348c5f3eddeeca3d7c2973","status":"affected","lessThan":"091a68c58c1bbd2ab7d05d1b32c1306394ec691d","versionType":"git"},{"version":"fb91065851cd5f2735348c5f3eddeeca3d7c2973","status":"affected","lessThan":"a33f7f9660705fb2ecf3467b2c48965564f392ce","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.12","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.12","versionType":"semver"},{"version":"6.12.16","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.13.4","status":"unaffected","lessThanOrEqual":"6.13.*","versionType":"semver"},{"version":"6.14","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c"]}],"references":["https://git.kernel.org/stable/c/ae5ab1c1ae504f622cc1ff48830a9ed48428146d","https://git.kernel.org/stable/c/091a68c58c1bbd2ab7d05d1b32c1306394ec691d","https://git.kernel.org/stable/c/a33f7f9660705fb2ecf3467b2c48965564f392ce"],"weaknesses":[],"ingestedAt":"2026-10-29T20:08:39.238Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/21xxx/CVE-2025-21842.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-21842","state":"PUBLISHED","datePublished":"2025-03-07T09:10:00.298Z","dateUpdated":"2026-08-05T11:54:51.838Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-12-29T08:45:45.777Z"},"containers":{"cna":{"title":"amdkfd: properly free gang_ctx_bo when failed to init user queue","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\namdkfd: properly free gang_ctx_bo when failed to init user queue\n\nThe destructor of a gtt bo is declared as\nvoid amdgpu_amdkfd_free_gtt_mem(struct amdgpu_device *adev, void **mem_obj);\nWhich takes void** as the second parameter.\n\nGCC allows passing void* to the function because void* can be implicitly\ncasted to any other types, so it can pass compiling.\n\nHowever, passing this void* parameter into the function's\nexecution process(which expects void** and dereferencing void**)\nwill result in errors."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"fb91065851cd5f2735348c5f3eddeeca3d7c2973","status":"affected","lessThan":"ae5ab1c1ae504f622cc1ff48830a9ed48428146d","versionType":"git"},{"version":"fb91065851cd5f2735348c5f3eddeeca3d7c2973","status":"affected","lessThan":"091a68c58c1bbd2ab7d05d1b32c1306394ec691d","versionType":"git"},{"version":"fb91065851cd5f2735348c5f3eddeeca3d7c2973","status":"affected","lessThan":"a33f7f9660705fb2ecf3467b2c48965564f392ce","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.12","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.12","versionType":"semver"},{"version":"6.12.16","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.13.4","status":"unaffected","lessThanOrEqual":"6.13.*","versionType":"semver"},{"version":"6.14","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/ae5ab1c1ae504f622cc1ff48830a9ed48428146d"},{"url":"https://git.kernel.org/stable/c/091a68c58c1bbd2ab7d05d1b32c1306394ec691d"},{"url":"https://git.kernel.org/stable/c/a33f7f9660705fb2ecf3467b2c48965564f392ce"}],"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 vulnerability is reached through the AMDKFD_IOC_CREATE_QUEUE ioctl on the local /dev/kfd character device; there is no network vector.\nAC:L - The attacker controls the trigger — supplying a wptr buffer allocated on a different GPU deterministically hits the device-mismatch error path on multi-GPU systems, or GART/pin exhaustion forces the map failure; no uncontrollable condition is required.\nPR:L - The create-queue ioctl carries flags=0 with no capability check, so any unprivileged local user with render-group access to /dev/kfd (typical on desktops/workstations) can reach it.\nUI:N - Exploitation is a direct ioctl sequence from the attacker's own process with no victim action required.\nS:U - The invalid dereference and any resulting corruption occur within the kernel's own security authority; no privilege/isolation boundary such as a VM or IOMMU domain is crossed.\nC:H - This pointer-vs-pointer-to-pointer type confusion dereferences a fixed userspace-mappable address (0x200000002); on non-SMAP/PAN or nosmap systems the attacker can back that address with a crafted fake amdgpu_bo, yielding attacker-controlled kernel reads.\nI:H - The same crafted-object primitive feeds amdgpu_bo unpin/unref, which perform refcount decrements and destructor dispatch on the attacker-controlled structure, enabling kernel memory corruption and potential control-flow hijack.\nA:H - On the common case (SMAP enabled) the wild dereference of 0x200000002 faults immediately, producing a kernel oops/panic and denial of service."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T11:54:51.838Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"6.12.16"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"6.13.4"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"6.14"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}