CVE-2022-50170 kunit: executor: Fix a memory leak on failure in kunit_filter_tests

Medium 5.5 Published Updated

A memory leak in the Linux kernel's KUnit executor can lead to resource exhaustion and denial of service.

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

What is CVE-2022-50170?

CVE-2022-50170 is a medium-severity memory corruption vulnerability in Linux kernel, published on 18 Jun 2025. 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:

kunit: executor: Fix a memory leak on failure in kunit_filter_tests

It's possible that memory allocation for 'filtered' will fail, but for the copy of the suite to succeed. In this case, the copy could be leaked.

Properly free 'copy' in the error case for the allocation of 'filtered' failing.

Note that there may also have been a similar issue in kunit_filter_subsuites, before it was removed in "kunit: flatten kunit_suite*** to kunit_suite** in .kunit_test_suites".

This was reported by clang-analyzer via the kernel test robot, here: https://lore.kernel.org/all/[email protected]/

And by smatch via Dan Carpenter and the kernel test robot: https://lore.kernel.org/all/[email protected]/

Weakness: CWE-401

Which versions are affected by CVE-2022-50170?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2022-50170?

Apply the vendor's patch.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2022-50170 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as DEBIAN-CVE-2022-50170, GHSA-729q-4w2j-59v3, UBUNTU-CVE-2022-50170.

Is CVE-2022-50170 in your software?

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

Check your SBOMs for free