# CVE-2022-50148: kernfs: fix potential NULL dereference in __kernfs_remove

- Severity: Medium 5.5 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.20%, higher than 10% of CVEs (2026-12-01)
- Published: 2025-06-18T11:03:08.462Z
- Modified: 2026-06-17T05:22:51.487Z
- Weaknesses: CWE-476
- Assigned by: Linux

## Description

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

kernfs: fix potential NULL dereference in __kernfs_remove

When lockdep is enabled, lockdep_assert_held_write would
cause potential NULL pointer dereference.

Fix the following smatch warnings:

fs/kernfs/dir.c:1353 __kernfs_remove() warn: variable dereferenced before check 'kn' (see line 1346)

(As written by CVE List.)

## Affected

- Linux Linux: from 393c3714081a53795bbff0e985d24146def6f57f before b871986d9d3071f5082664ac274d93f08db257cd; from 393c3714081a53795bbff0e985d24146def6f57f before 4a9f35b8729c5bf13ea671c908c17ed74c48fc50; from 393c3714081a53795bbff0e985d24146def6f57f before 72b5d5aef246a0387cefa23121dd90901c7a691a; 5.17 (not affected: before 5.17; from 5.18.18 up to 5.18.*; from 5.19.2 up to 5.19.*; from 6.0 up to *)
- linux linux_kernel: from 5.17 before 5.18.18; from 5.19 before 5.19.2

## References

- <https://git.kernel.org/stable/c/b871986d9d3071f5082664ac274d93f08db257cd> (patch)
- <https://git.kernel.org/stable/c/4a9f35b8729c5bf13ea671c908c17ed74c48fc50> (patch)
- <https://git.kernel.org/stable/c/72b5d5aef246a0387cefa23121dd90901c7a691a> (patch)

## Sources

- CVE List: [CVE-2022-50148](https://www.cve.org/CVERecord?id=CVE-2022-50148), CVE Terms of Use, modified 2026-05-11
- NVD: [CVE-2022-50148](https://nvd.nist.gov/vuln/detail/CVE-2022-50148), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2022-50148 · Whole record: https://cve.day/CVE-2022-50148.json · Rebuilt by cve.day 2026-11-25T22:58:21.076Z
