Patch "usb: xhci: Add error handling in xhci_map_urb_for_dma" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    usb: xhci: Add error handling in xhci_map_urb_for_dma

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     usb-xhci-add-error-handling-in-xhci_map_urb_for_dma.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 84392dd94d528f42ed47ba2f63b5694d8b5e67f7
Author: Prashanth K <quic_prashk@xxxxxxxxxxx>
Date:   Thu Feb 29 16:14:38 2024 +0200

    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@xxxxxxxxxxxxxxx # 5.11
    Fixes: 2017a1e58472 ("usb: xhci: Use temporary buffer to consolidate SG")
    Signed-off-by: Prashanth K <quic_prashk@xxxxxxxxxxx>
    Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240229141438.619372-10-mathias.nyman@xxxxxxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 132b76fa7ca60..c4c733d724bd8 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1178,6 +1178,8 @@ static int xhci_map_temp_buffer(struct usb_hcd *hcd, struct urb *urb)
 
 	temp = kzalloc_node(buf_len, GFP_ATOMIC,
 			    dev_to_node(hcd->self.sysdev));
+	if (!temp)
+		return -ENOMEM;
 
 	if (usb_urb_dir_out(urb))
 		sg_pcopy_to_buffer(urb->sg, urb->num_sgs,




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux