CVE-2024-26964: usb: xhci: Add error handling in xhci_map_urb_for_dma
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
usb: xhci: Add error handling in xhci_map_urb_for_dma
Currently xhci_map_urb_for_dma() creates a temporary buffer and copies the SG list to the new linear buffer. But if the kzalloc_node() fails, then the following sg_pcopy_to_buffer() can lead to crash since it tries to memcpy to NULL pointer.
So return -ENOMEM if kzalloc returns null pointer.
The Linux kernel CVE team has assigned CVE-2024-26964 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.11 with commit 2017a1e58472 and fixed in 5.15.154 with commit 4a49d24fdec0 Issue introduced in 5.11 with commit 2017a1e58472 and fixed in 6.1.84 with commit b2c898469dfc Issue introduced in 5.11 with commit 2017a1e58472 and fixed in 6.6.24 with commit 620b6cf2f1a2 Issue introduced in 5.11 with commit 2017a1e58472 and fixed in 6.7.12 with commit 962300a360d2 Issue introduced in 5.11 with commit 2017a1e58472 and fixed in 6.8.3 with commit 7b6cc33593d7 Issue introduced in 5.11 with commit 2017a1e58472 and fixed in 6.9-rc1 with commit be95cc6d71df
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-26964
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/host/xhci.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/4a49d24fdec0a802aa686a567a3989a9fdf4e5dd https://git.kernel.org/stable/c/b2c898469dfc388f619c6c972a28466cbb1442ea https://git.kernel.org/stable/c/620b6cf2f1a270f48d38e6b8ce199c1acb3e90f4 https://git.kernel.org/stable/c/962300a360d24c5be5a188cda48da58a37e4304d https://git.kernel.org/stable/c/7b6cc33593d7ccfc3011b290849cfa899db46757 https://git.kernel.org/stable/c/be95cc6d71dfd0cba66e3621c65413321b398052