CVE-2023-53848: md/raid5-cache: fix a deadlock in r5l_exit_log()
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
md/raid5-cache: fix a deadlock in r5l_exit_log()
Commit b13015af94cf ("md/raid5-cache: Clear conf->log after finishing work") introduce a new problem:
// caller hold reconfig_mutexr5l_exit_log
flush_work(&log->disable_writeback_work)
r5c_disable_writeback_async wait_event /* * conf->log is not NULL, and mddev_trylock() * will fail, wait_event() can never pass. */
conf->log = NULL
Fix this problem by setting 'config->log' to NULL before wake_up() as it used to be, so that wait_event() from r5c_disable_writeback_async() can exist. In the meantime, move forward md_unregister_thread() so that null-ptr-deref this commit fixed can still be fixed.
The Linux kernel CVE team has assigned CVE-2023-53848 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.0 with commit b13015af94cf405f73ff64ce0797269554020c37 and fixed in 6.1.53 with commit ac9e103f282a7854f3274ef5ff0742fbbe8d7d6b Issue introduced in 6.0 with commit b13015af94cf405f73ff64ce0797269554020c37 and fixed in 6.4.16 with commit 71cf23271f015a57038bdc4669952096f9fe5500 Issue introduced in 6.0 with commit b13015af94cf405f73ff64ce0797269554020c37 and fixed in 6.5.3 with commit c406984738215dc20ac2dc63e49d70f20797730e Issue introduced in 6.0 with commit b13015af94cf405f73ff64ce0797269554020c37 and fixed in 6.6 with commit a705b11b358dee677aad80630e7608b2d5f56691
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-53848
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/raid5-cache.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/ac9e103f282a7854f3274ef5ff0742fbbe8d7d6b https://git.kernel.org/stable/c/71cf23271f015a57038bdc4669952096f9fe5500 https://git.kernel.org/stable/c/c406984738215dc20ac2dc63e49d70f20797730e https://git.kernel.org/stable/c/a705b11b358dee677aad80630e7608b2d5f56691