CVE-2022-50148: kernfs: fix potential NULL dereference in __kernfs_remove
From: Greg Kroah-Hartman <[email protected]>
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)
The Linux kernel CVE team has assigned CVE-2022-50148 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.17 with commit 393c3714081a53795bbff0e985d24146def6f57f and fixed in 5.18.18 with commit b871986d9d3071f5082664ac274d93f08db257cd Issue introduced in 5.17 with commit 393c3714081a53795bbff0e985d24146def6f57f and fixed in 5.19.2 with commit 4a9f35b8729c5bf13ea671c908c17ed74c48fc50 Issue introduced in 5.17 with commit 393c3714081a53795bbff0e985d24146def6f57f and fixed in 6.0 with commit 72b5d5aef246a0387cefa23121dd90901c7a691a
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2022-50148
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
fs/kernfs/dir.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/b871986d9d3071f5082664ac274d93f08db257cd https://git.kernel.org/stable/c/4a9f35b8729c5bf13ea671c908c17ed74c48fc50 https://git.kernel.org/stable/c/72b5d5aef246a0387cefa23121dd90901c7a691a