Patch "usb: storage: Add check for kcalloc" has been added to the 4.9-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: storage: Add check for kcalloc

to the 4.9-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-storage-add-check-for-kcalloc.patch
and it can be found in the queue-4.9 subdirectory.

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



commit 030978127f9cdd47ec001620cb1f277924f0dfae
Author: Jiasheng Jiang <jiasheng@xxxxxxxxxxx>
Date:   Thu Dec 8 19:00:58 2022 +0800

    usb: storage: Add check for kcalloc
    
    [ Upstream commit c35ca10f53c51eeb610d3f8fbc6dd6d511b58a58 ]
    
    As kcalloc may return NULL pointer, the return value should
    be checked and return error if fails as same as the ones in
    alauda_read_map.
    
    Fixes: e80b0fade09e ("[PATCH] USB Storage: add alauda support")
    Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Jiasheng Jiang <jiasheng@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221208110058.12983-1-jiasheng@xxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
index 878b4b8761f5..3dbd60540372 100644
--- a/drivers/usb/storage/alauda.c
+++ b/drivers/usb/storage/alauda.c
@@ -450,6 +450,8 @@ static int alauda_init_media(struct us_data *us)
 		+ MEDIA_INFO(us).blockshift + MEDIA_INFO(us).pageshift);
 	MEDIA_INFO(us).pba_to_lba = kcalloc(num_zones, sizeof(u16*), GFP_NOIO);
 	MEDIA_INFO(us).lba_to_pba = kcalloc(num_zones, sizeof(u16*), GFP_NOIO);
+	if (MEDIA_INFO(us).pba_to_lba == NULL || MEDIA_INFO(us).lba_to_pba == NULL)
+		return USB_STOR_TRANSPORT_ERROR;
 
 	if (alauda_reset_media(us) != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_ERROR;



[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