CVE-2022-50451: fs/ntfs3: Fix memory leak on ntfs_fill_super() error path
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
fs/ntfs3: Fix memory leak on ntfs_fill_super() error path
syzbot reported kmemleak as below:
BUG: memory leak
unreferenced object 0xffff8880122f1540 (size 32):
comm "a.out", pid 6664, jiffies 4294939771 (age 25.500s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 ed ff ed ff 00 00 00 00 ................
backtrace:
[<ffffffff81b16052>] ntfs_init_fs_context+0x22/0x1c0
[<ffffffff8164aaa7>] alloc_fs_context+0x217/0x430
[<ffffffff81626dd4>] path_mount+0x704/0x1080
[<ffffffff81627e7c>] __x64_sys_mount+0x18c/0x1d0
[<ffffffff84593e14>] do_syscall_64+0x34/0xb0
[<ffffffff84600087>] entry_SYSCALL_64_after_hwframe+0x63/0xcdThis patch fixes this issue by freeing mount options on error path of ntfs_fill_super().
The Linux kernel CVE team has assigned CVE-2022-50451 to this issue.
Affected and fixed versions
===========================
Fixed in 5.15.87 with commit 2dd9ccfb06bcdad30ad92d96c3affa38a458679e Fixed in 6.0.17 with commit ff0df7d9cdbb12878155168b5234e99029e5377f Fixed in 6.1.3 with commit 2600c80ea7b39f987c3fa89287e73d62e322bbbd Fixed in 6.2 with commit 51e76a232f8c037f1d9e9922edc25b003d5f3414
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-50451
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/ntfs3/super.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/2dd9ccfb06bcdad30ad92d96c3affa38a458679e https://git.kernel.org/stable/c/ff0df7d9cdbb12878155168b5234e99029e5377f https://git.kernel.org/stable/c/2600c80ea7b39f987c3fa89287e73d62e322bbbd https://git.kernel.org/stable/c/51e76a232f8c037f1d9e9922edc25b003d5f3414