CVE-2024-42307: cifs: fix potential null pointer use in destroy_workqueue in init_cifs error path
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
cifs: fix potential null pointer use in destroy_workqueue in init_cifs error path
Dan Carpenter reported a Smack static checker warning:
fs/smb/client/cifsfs.c:1981 init_cifs()
error: we previously assumed 'serverclose_wq' could be null (see line 1895)
The patch which introduced the serverclose workqueue used the wrong oredering in error paths in init_cifs() for freeing it on errors.
The Linux kernel CVE team has assigned CVE-2024-42307 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.1.85 with commit 8c99dfb49bdc and fixed in 6.1.103 with commit 6018971710fd Issue introduced in 6.6.26 with commit 6f17163b9339 and fixed in 6.6.44 with commit 160235efb4f9 Issue introduced in 6.9 with commit 173217bd7336 and fixed in 6.10.3 with commit 3739d711246d Issue introduced in 6.9 with commit 173217bd7336 and fixed in 6.11-rc1 with commit 193cc89ea0ca Issue introduced in 6.8.5 with commit 40a5d14c9d3b
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-2024-42307
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/smb/client/cifsfs.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/6018971710fdc7739f8655c1540832b4bb903671 https://git.kernel.org/stable/c/160235efb4f9b55212dedff5de0094c606c4b303 https://git.kernel.org/stable/c/3739d711246d8fbc95ff73dbdace9741cdce4777 https://git.kernel.org/stable/c/193cc89ea0ca1da311877d2b4bb5e9f03bcc82a2