---
id: CVE-2021-47081
title: |-
  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_ke…
summary: |-
  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_ke…
severity: high
cvss: 7.8
cvssVector: 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'
cwe:
  - CWE-416
vendor: linux
product: linux_kernel
affected:
  - 'linux_kernel >= 5.12, < 5.12.7'
  - linux_kernel = 5.13
patched:
  - linux_kernel 5.12.7
published: '2024-03-01'
updated: '2026-08-04'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2021-47081'
references:
  - url: 'https://git.kernel.org/stable/c/115726c5d312b462c9d9931ea42becdfa838a076'
    label: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
  - url: 'https://git.kernel.org/stable/c/b49f5af30b0e4064fbd91e83823a4bfcb2c7a3e7'
    label: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
  - url: 'https://git.kernel.org/stable/c/115726c5d312b462c9d9931ea42becdfa838a076'
    label: af854a3a-2127-422b-91ae-364da2661108
  - url: 'https://git.kernel.org/stable/c/b49f5af30b0e4064fbd91e83823a4bfcb2c7a3e7'
    label: af854a3a-2127-422b-91ae-364da2661108
tags:
  - nvd
epss: 0.00231
epssPercentile: 0.12503
ingestedAt: '2026-08-04T10:39:39.950Z'
---

## Overview

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

- `linux_kernel >= 5.12, < 5.12.7`
- `linux_kernel = 5.13`

## Remediation

Upgrade past the affected range:

- `linux_kernel 5.12.7`
