# CVE-2021-47081: habanalabs/gaudi: Fix a potential use after free in gaudi_memset_device_memory

- Severity: High 7.8 (CVSS:3.1, scored by Linux) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.23%, higher than 15% of CVEs (2026-12-01)
- Published: 2024-03-01T21:15:16.684Z
- Modified: 2026-08-05T08:45:52.781Z
- Weaknesses: CWE-416
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: Linux

## Description

In the Linux kernel, the following vulnerability has been resolved:

habanalabs/gaudi: Fix a potential use after free in gaudi_memset_device_memory

Our code analyzer reported a uaf.

In gaudi_memset_device_memory, cb is get via hl_cb_kernel_create()
with 2 refcount.
If hl_cs_allocate_job() failed, the execution runs into release_cb
branch. One ref of cb is dropped by hl_cb_put(cb) and could be freed
if other thread also drops one ref. Then cb is used by cb->id later,
which is a potential uaf.

My patch add a variable 'id' to accept the value of cb->id before the
hl_cb_put(cb) is called, to avoid the potential uaf.

(As written by CVE List.)

## Affected

- Linux Linux: from 423815bf02e257091d5337be5c63b57fc29e4254 before b49f5af30b0e4064fbd91e83823a4bfcb2c7a3e7; from 423815bf02e257091d5337be5c63b57fc29e4254 before 115726c5d312b462c9d9931ea42becdfa838a076; 5.12 (not affected: before 5.12; from 5.12.7 up to 5.12.*; from 5.13 up to *)
- linux linux_kernel: from 5.12 before 5.12.7; 5.13

## Every score

- Linux: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://git.kernel.org/stable/c/b49f5af30b0e4064fbd91e83823a4bfcb2c7a3e7> (patch)
- <https://git.kernel.org/stable/c/115726c5d312b462c9d9931ea42becdfa838a076> (patch)

## Sources

- CVE List: [CVE-2021-47081](https://www.cve.org/CVERecord?id=CVE-2021-47081), CVE Terms of Use, modified 2026-08-05
- NVD: [CVE-2021-47081](https://nvd.nist.gov/vuln/detail/CVE-2021-47081), Public domain, modified 2026-08-04

---

Page: https://cve.day/CVE-2021-47081 · Whole record: https://cve.day/CVE-2021-47081.json · Rebuilt by cve.day 2026-11-25T22:58:08.651Z
