CVE-2023-53722: md: raid1: fix potential OOB in raid1_remove_disk()
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
md: raid1: fix potential OOB in raid1_remove_disk()
If rddev->raid_disk is greater than mddev->raid_disks, there will be an out-of-bounds in raid1_remove_disk(). We have already found similar reports as follows:
1) commit d17f744e883b ("md-raid10: fix KASAN warning")
2) commit 1ebc2cec0b7d ("dm raid: fix KASAN warning in raid5_remove_disk")
Fix this bug by checking whether the "number" variable is valid.
The Linux kernel CVE team has assigned CVE-2023-53722 to this issue.
Affected and fixed versions
===========================
Fixed in 4.14.326 with commit beedf40f73939f248c81802eda08a2a8148ea13e Fixed in 4.19.295 with commit 91fbd4e75cb573f44d2619a9dc2f9ba927040760 Fixed in 5.4.257 with commit 25a68f2286be56fb3a6f9fa0e269c04b5e6c6e24 Fixed in 5.10.197 with commit 7993cfc041481a3a9cd4a3858088fc846b8ccaf7 Fixed in 5.15.133 with commit 4f96c0665f9f4cf70130c9757750dc43dc679c82 Fixed in 6.1.55 with commit 4f7d853b4590fc20e90dd50e346c02811a8c5b08 Fixed in 6.5.5 with commit 4bdb92eaf645e312975357adc3c4e9523b6e67f1 Fixed in 6.6 with commit 8b0472b50bcf0f19a5119b00a53b63579c8e1e4d
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-2023-53722
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:
drivers/md/raid1.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/beedf40f73939f248c81802eda08a2a8148ea13e https://git.kernel.org/stable/c/91fbd4e75cb573f44d2619a9dc2f9ba927040760 https://git.kernel.org/stable/c/25a68f2286be56fb3a6f9fa0e269c04b5e6c6e24 https://git.kernel.org/stable/c/7993cfc041481a3a9cd4a3858088fc846b8ccaf7 https://git.kernel.org/stable/c/4f96c0665f9f4cf70130c9757750dc43dc679c82 https://git.kernel.org/stable/c/4f7d853b4590fc20e90dd50e346c02811a8c5b08 https://git.kernel.org/stable/c/4bdb92eaf645e312975357adc3c4e9523b6e67f1 https://git.kernel.org/stable/c/8b0472b50bcf0f19a5119b00a53b63579c8e1e4d