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

High 7.8 Published Updated

A use-after-free vulnerability in the Linux kernel's habanalabs driver allows attackers to potentially execute arbitrary code or escalate privileges.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
None listed

What is CVE-2021-47081?

CVE-2021-47081 is a high-severity use after free vulnerability in Linux kernel, published on 1 Mar 2024. It can only be exploited from the same machine or local network, with no action from the victim.

Official 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.

Weakness: CWE-416

Which versions are affected by CVE-2021-47081?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2021-47081?

No fix has been published for CVE-2021-47081 yet. Limit exposure of the affected software until one is available.

Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.

Is CVE-2021-47081 being exploited?

There is no known exploitation of CVE-2021-47081 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as GHSA-xmvq-5949-6227, UBUNTU-CVE-2021-47081.

Is CVE-2021-47081 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free