{"id":"CVE-2021-47081","state":"PUBLISHED","title":"habanalabs/gaudi: Fix a potential use after free in gaudi_memset_device_memory","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nhabanalabs/gaudi: Fix a potential use after free in gaudi_memset_device_memory\n\nOur code analyzer reported a uaf.\n\nIn gaudi_memset_device_memory, cb is get via hl_cb_kernel_create()\nwith 2 refcount.\nIf hl_cs_allocate_job() failed, the execution runs into release_cb\nbranch. One ref of cb is dropped by hl_cb_put(cb) and could be freed\nif other thread also drops one ref. Then cb is used by cb->id later,\nwhich is a potential uaf.\n\nMy patch add a variable 'id' to accept the value of cb->id before the\nhl_cb_put(cb) is called, to avoid the potential uaf.","publishedAt":"2024-03-01T21:15:16.684Z","updatedAt":"2026-08-05T08:45:52.781Z","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":"423815bf02e257091d5337be5c63b57fc29e4254","status":"affected","lessThan":"b49f5af30b0e4064fbd91e83823a4bfcb2c7a3e7","versionType":"git"},{"version":"423815bf02e257091d5337be5c63b57fc29e4254","status":"affected","lessThan":"115726c5d312b462c9d9931ea42becdfa838a076","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/misc/habanalabs/gaudi/gaudi.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.12","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.12","versionType":"semver"},{"version":"5.12.7","status":"unaffected","lessThanOrEqual":"5.12.*","versionType":"semver"},{"version":"5.13","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/misc/habanalabs/gaudi/gaudi.c"]}],"references":["https://git.kernel.org/stable/c/b49f5af30b0e4064fbd91e83823a4bfcb2c7a3e7","https://git.kernel.org/stable/c/115726c5d312b462c9d9931ea42becdfa838a076"],"weaknesses":[],"ingestedAt":"2026-10-29T19:49:19.404Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2021/47xxx/CVE-2021-47081.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2021-47081","state":"PUBLISHED","datePublished":"2024-03-01T21:15:16.684Z","dateUpdated":"2026-08-05T08:45:52.781Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-02-29T22:33:44.298Z"},"containers":{"cna":{"title":"habanalabs/gaudi: Fix a potential use after free in gaudi_memset_device_memory","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nhabanalabs/gaudi: Fix a potential use after free in gaudi_memset_device_memory\n\nOur code analyzer reported a uaf.\n\nIn gaudi_memset_device_memory, cb is get via hl_cb_kernel_create()\nwith 2 refcount.\nIf hl_cs_allocate_job() failed, the execution runs into release_cb\nbranch. One ref of cb is dropped by hl_cb_put(cb) and could be freed\nif other thread also drops one ref. Then cb is used by cb->id later,\nwhich is a potential uaf.\n\nMy patch add a variable 'id' to accept the value of cb->id before the\nhl_cb_put(cb) is called, to avoid the potential uaf."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"423815bf02e257091d5337be5c63b57fc29e4254","status":"affected","lessThan":"b49f5af30b0e4064fbd91e83823a4bfcb2c7a3e7","versionType":"git"},{"version":"423815bf02e257091d5337be5c63b57fc29e4254","status":"affected","lessThan":"115726c5d312b462c9d9931ea42becdfa838a076","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/misc/habanalabs/gaudi/gaudi.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.12","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.12","versionType":"semver"},{"version":"5.12.7","status":"unaffected","lessThanOrEqual":"5.12.*","versionType":"semver"},{"version":"5.13","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/misc/habanalabs/gaudi/gaudi.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/b49f5af30b0e4064fbd91e83823a4bfcb2c7a3e7"},{"url":"https://git.kernel.org/stable/c/115726c5d312b462c9d9931ea42becdfa838a076"}],"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 vulnerable path is reached by opening and closing the local HabanaLabs char device (/dev/hl*), which triggers context release, memory scrubbing, and gaudi_memset_device_memory; it is not reachable via network packets.\nAC:L - An attacker who can open the device reliably drives the put-then-use-id cleanup on every scrub/memset invocation, and use-after-free races of this kind are treated as attacker-influencible rather than requiring uncontrollable conditions.\nPR:L - hl_device_open performs no capability check, and Gaudi device nodes are routinely granted to unprivileged users via udev group/world permissions in real deployments, matching other scored habanalabs CVEs.\nUI:N - The attacker triggers the bug solely by opening and closing the device themselves; no separate victim action is required.\nS:U - Impact is confined to the host kernel authority (local privilege escalation / memory corruption); there is no VM, IOMMU, or other security-authority boundary crossed.\nC:H - This is a use-after-free on a kernel command-buffer object; UAF enables heap reuse and disclosure of freed object contents, so confidentiality impact is High.\nI:H - Use-after-free of the CB object can be turned into heap spray and arbitrary write / control-flow hijacking primitives, so integrity impact is High.\nA:H - Use-after-free of kernel memory can cause kernel oops/panic or device-driver failure, yielding High availability impact."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T08:45:52.781Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.12","versionEndExcluding":"5.12.7"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.12","versionEndExcluding":"5.13"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2021-47081","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"version":"2.0.3","timestamp":"2024-03-04T19:32:29.244809Z"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2024-06-04T17:14:15.058Z"}},{"title":"CVE Program Container","references":[{"url":"https://git.kernel.org/stable/c/b49f5af30b0e4064fbd91e83823a4bfcb2c7a3e7","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/115726c5d312b462c9d9931ea42becdfa838a076","tags":["x_transferred"]}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2024-08-04T05:24:39.774Z"}}]}}}