7.8high
habanalabs/gaudi: Fix a potential use after free in gaudi_memset_device_memory
- Severity
- 7.8high CVSS:3.1 by Linux
- Exploit likelihood
- 0.23% (higher than 15% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- 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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| 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 * | CVE List |
| linux linux_kernel | from 5.12 before 5.12.7, 5.13 | NVD |
All scores
| Linux | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
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.
NVD (es)
En el kernel de Linux se ha resuelto la siguiente vulnerabilidad: habanalabs/gaudi: Corregir un uso potencial después de liberar en gaudi_memset_device_memory Nuestro analizador de código reportó un uaf. En gaudi_memset_device_memory, cb se obtiene a través de hl_cb_kernel_create() con 2 refcount. Si hl_cs_allocate_job() falla, la ejecución se ejecuta en la rama release_cb. hl_cb_put(cb) elimina una referencia de cb y podría liberarse si otro hilo también elimina una referencia. Luego, cb->id usa cb más tarde, que es un uaf potencial. Mi parche agrega una variable 'id' para aceptar el valor de cb->id antes de llamar a hl_cb_put(cb), para evitar el potencial uaf.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-47081 changed 2026-08-05 | CVE Terms of Use |
| NVD | CVE-2021-47081 changed 2026-08-04 | Public domain |