CVE-2022-50840
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().
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
A use-after-free (UAF) vulnerability in the Linux kernel's SNIC driver, where a target structure is freed without being removed from a list, potentially allowing list traversal to access freed memory.
Vulnerability
Analysis
The Linux kernel's SNIC (Samsung NVM Express over Fabrics Initiator) driver contains a use-after-free (UAF) vulnerability in the snic_tgt_create() function in drivers/scsi/snic/snic_disc.c. The issue arises when device_add() fails — the allocated target structure (tgt) is freed, but the tgt->list entry is not removed from the snic->disc.tgt_list linked list [1][2][3][4]. This leaves a dangling list element pointing to freed memory.
Exploitation
To trigger this vulnerability, an attacker would need to cause device_add() to fail within snic_tgt_create(). This could happen, for example, if the system runs out of memory or if a device number conflict occurs. Once the structure is freed but remains on the list, any subsequent traversal of tgt_list (e.g., during discovery or other operations) will dereference a freed tgt pointer, leading to a use-after-free. No specific prerequisites beyond local access are mentioned, but exploitation likely requires some ability to influence device enumeration or trigger resource exhaustion.
Impact
A successful exploit could allow an attacker to cause a kernel crash (denial of service) or potentially achieve arbitrary code execution due to the UAF condition. The vulnerability could lead to privilege escalation if triggered from a less privileged context, though the attack surface is limited attack surface makes remote exploitation unlikely without prior access to the system.
Mitigation
The fix, introduced in the Linux kernel stable tree, removes the tgt from snic->disc.tgt_list before calling kfree() on failure, ensuring the list remains consistent [1][2][3][4]. Users should apply the patched kernel version containing the commit that addresses this issue.
AI Insight generated on May 19, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
1Patches
9f9d8b8ba0f1a3772319e40523007f96ca20c6866154c23fbad27f74e901f1895e908b3aec7f0f8dab1ae4141cd9e8b33e118df492320Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
9- git.kernel.org/stable/c/1895e908b3ae66a5312fd1b2cdda2da82993dca7nvd
- git.kernel.org/stable/c/3007f96ca20c848d0b1b052df6d2cb5ae5586e78nvd
- git.kernel.org/stable/c/3772319e40527e6a5f2ec1d729e01f271d818f5cnvd
- git.kernel.org/stable/c/4141cd9e8b3379aea52a85d2c35f6eaf26d14e86nvd
- git.kernel.org/stable/c/6866154c23fba40888ad6d554cccd4bf2edb755envd
- git.kernel.org/stable/c/ad27f74e901fc48729733c88818e6b96c813057dnvd
- git.kernel.org/stable/c/c7f0f8dab1ae5def57c1a8a9cafd6fabe1dc27ccnvd
- git.kernel.org/stable/c/e118df492320176af94deec000ae034cc92be754nvd
- git.kernel.org/stable/c/f9d8b8ba0f1a16cde0b1fc9e80466df76b6db8ffnvd
News mentions
0No linked articles in our index yet.