Patch "net/9p/usbg: fix handling of the failed kzalloc() memory allocation" has been added to the 6.12-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

    net/9p/usbg: fix handling of the failed kzalloc() memory allocation

to the 6.12-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:
     net-9p-usbg-fix-handling-of-the-failed-kzalloc-memor.patch
and it can be found in the queue-6.12 subdirectory.

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



commit bd2eb44c32a6bfae084d48a362a2455bc2860471
Author: Mirsad Todorovac <mtodorovac69@xxxxxxxxx>
Date:   Sat Nov 9 22:18:41 2024 +0100

    net/9p/usbg: fix handling of the failed kzalloc() memory allocation
    
    [ Upstream commit ff1060813d9347e8c45c8b8cff93a4dfdb6726ad ]
    
    On the linux-next, next-20241108 vanilla kernel, the coccinelle tool gave the
    following error report:
    
    ./net/9p/trans_usbg.c:912:5-11: ERROR: allocation function on line 911 returns
    NULL not ERR_PTR on failure
    
    kzalloc() failure is fixed to handle the NULL return case on the memory exhaustion.
    
    Fixes: a3be076dc174d ("net/9p/usbg: Add new usb gadget function transport")
    Cc: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
    Cc: Eric Van Hensbergen <ericvh@xxxxxxxxxx>
    Cc: Latchesar Ionkov <lucho@xxxxxxxxxx>
    Cc: Dominique Martinet <asmadeus@xxxxxxxxxxxxx>
    Cc: Christian Schoenebeck <linux_oss@xxxxxxxxxxxxx>
    Cc: v9fs@xxxxxxxxxxxxxxx
    Cc: linux-kernel@xxxxxxxxxxxxxxx
    Signed-off-by: Mirsad Todorovac <mtodorovac69@xxxxxxxxx>
    Message-ID: <20241109211840.721226-2-mtodorovac69@xxxxxxxxx>
    Signed-off-by: Dominique Martinet <asmadeus@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/9p/trans_usbg.c b/net/9p/trans_usbg.c
index 975b76839dca1..6b694f117aef2 100644
--- a/net/9p/trans_usbg.c
+++ b/net/9p/trans_usbg.c
@@ -909,9 +909,9 @@ static struct usb_function_instance *usb9pfs_alloc_instance(void)
 	usb9pfs_opts->buflen = DEFAULT_BUFLEN;
 
 	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-	if (IS_ERR(dev)) {
+	if (!dev) {
 		kfree(usb9pfs_opts);
-		return ERR_CAST(dev);
+		return ERR_PTR(-ENOMEM);
 	}
 
 	usb9pfs_opts->dev = dev;




[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