CVE-2022-50840 scsi: snic: Fix possible UAF in snic_tgt_create()

Not scored Published Updated

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

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

What is CVE-2022-50840?

CVE-2022-50840 is an use after free vulnerability in Linux, published on 30 Dec 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:

scsi: snic: Fix possible UAF in snic_tgt_create()

Smatch reports a warning as follows:

drivers/scsi/snic/snic_disc.c:307 snic_tgt_create() warn: '&tgt->list' not removed from list

If device_add() fails in snic_tgt_create(), tgt will be freed, but tgt->list will not be removed from snic->disc.tgt_list, then list traversal may cause UAF.

Remove from snic->disc.tgt_list before free().

Which versions are affected by CVE-2022-50840?

How do I fix CVE-2022-50840?

Apply the vendor's patch.

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-2022-50840 being exploited?

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

Sources

Also known as DEBIAN-CVE-2022-50840, GHSA-rwh2-wwjg-8c2j, UBUNTU-CVE-2022-50840.

Is CVE-2022-50840 in your software?

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

Check your SBOMs for free