CVE-2021-47467 kunit: fix reference count leak in kfree_at_end

Medium 5.3 Published Updated

A reference count leak in the Linux kernel's kunit testing framework can lead to resource exhaustion and denial of service.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2021-47467?

CVE-2021-47467 is a medium-severity vulnerability in Linux kernel, published on 22 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

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

kunit: fix reference count leak in kfree_at_end

The reference counting issue happens in the normal path of kfree_at_end(). When kunit_alloc_and_get_resource() is invoked, the function forgets to handle the returned resource object, whose refcount increased inside, causing a refcount leak.

Fix this issue by calling kunit_alloc_resource() instead of kunit_alloc_and_get_resource().

Fixed the following when applying: Shuah Khan <skhan@linuxfoundation.org>

CHECK: Alignment should match open parenthesis + kunit_alloc_resource(test, NULL, kfree_res_free, GFP_KERNEL, (void *)to_free);

Which versions are affected by CVE-2021-47467?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2021-47467?

Apply the vendor's patch.

Is CVE-2021-47467 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as DEBIAN-CVE-2021-47467, GHSA-7qcg-gp93-223m, UBUNTU-CVE-2021-47467.

Is CVE-2021-47467 in your software?

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

Check your SBOMs for free