]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: xhci: Add error handling in xhci_map_urb_for_dma
authorPrashanth K <quic_prashk@quicinc.com>
Thu, 29 Feb 2024 14:14:38 +0000 (16:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:11:14 +0000 (15:11 +0200)
commit962300a360d24c5be5a188cda48da58a37e4304d
treeeb7ccb82d542b85b1c5b0c365da0292517293600
parentae99e199037c580b7350bfa3596f447a53bcf01f
usb: xhci: Add error handling in xhci_map_urb_for_dma

[ Upstream commit be95cc6d71dfd0cba66e3621c65413321b398052 ]

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.

Cc: stable@vger.kernel.org # 5.11
Fixes: 2017a1e58472 ("usb: xhci: Use temporary buffer to consolidate SG")
Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20240229141438.619372-10-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/host/xhci.c