Commit 4782f1c2 authored by Prashanth K's avatar Prashanth K Committed by Treehugger Robot
Browse files

FROMGIT: 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.

Cc: stable@vger.kernel.org # 5.11
Fixes: 2017a1e5 ("usb: xhci: Use temporary buffer to consolidate SG")
Signed-off-by: default avatarPrashanth K <quic_prashk@quicinc.com>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20240229141438.619372-10-mathias.nyman@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 328151586
(cherry picked from commit be95cc6d
https: //git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ usb-next)
Change-Id: I02d1b43bd9910a28034d0363a2cca86864379aaf
Signed-off-by: default avatarPrashanth K <quic_prashk@quicinc.com>
parent 9b613572
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment