CVE-2024-58055: usb: gadget: f_tcm: Don't free command immediately
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: f_tcm: Don't free command immediately
Don't prematurely free the command. Wait for the status completion of the sense status. It can be freed then. Otherwise we will double-free the command.
The Linux kernel CVE team has assigned CVE-2024-58055 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.6 with commit cff834c16d23d614388aab1b86d19eb67b3f80c4 and fixed in 6.1.129 with commit f0c33e7d387ccbb6870e73a43c558fefede06614 Issue introduced in 4.6 with commit cff834c16d23d614388aab1b86d19eb67b3f80c4 and fixed in 6.6.76 with commit 16907219ad6763f401700e1b57b2da4f3e07f047 Issue introduced in 4.6 with commit cff834c16d23d614388aab1b86d19eb67b3f80c4 and fixed in 6.12.13 with commit 929b69810eec132b284ffd19047a85d961df9e4d Issue introduced in 4.6 with commit cff834c16d23d614388aab1b86d19eb67b3f80c4 and fixed in 6.13.2 with commit e6693595bd1b55af62d057a4136a89d5c2ddf0e9 Issue introduced in 4.6 with commit cff834c16d23d614388aab1b86d19eb67b3f80c4 and fixed in 6.14-rc1 with commit c225d006a31949d673e646d585d9569bc28feeb9
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-58055
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/usb/gadget/function/f_tcm.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/f0c33e7d387ccbb6870e73a43c558fefede06614 https://git.kernel.org/stable/c/16907219ad6763f401700e1b57b2da4f3e07f047 https://git.kernel.org/stable/c/929b69810eec132b284ffd19047a85d961df9e4d https://git.kernel.org/stable/c/e6693595bd1b55af62d057a4136a89d5c2ddf0e9 https://git.kernel.org/stable/c/c225d006a31949d673e646d585d9569bc28feeb9