Patch "powerpc/powernv: Add a null pointer check to scom_debug_init_one()" 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

    powerpc/powernv: Add a null pointer check to scom_debug_init_one()

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:
     powerpc-powernv-add-a-null-pointer-check-to-scom_deb.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 de045c994103cfca35265f37a3475e6f9c27bbe3
Author: Kunwu Chan <chentao@xxxxxxxxxx>
Date:   Fri Dec 8 16:59:37 2023 +0800

    powerpc/powernv: Add a null pointer check to scom_debug_init_one()
    
    [ Upstream commit 9a260f2dd827bbc82cc60eb4f4d8c22707d80742 ]
    
    kasprintf() returns a pointer to dynamically allocated memory
    which can be NULL upon failure.
    Add a null pointer check, and release 'ent' to avoid memory leaks.
    
    Fixes: bfd2f0d49aef ("powerpc/powernv: Get rid of old scom_controller abstraction")
    Signed-off-by: Kunwu Chan <chentao@xxxxxxxxxx>
    Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
    Link: https://msgid.link/20231208085937.107210-1-chentao@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/powerpc/platforms/powernv/opal-xscom.c b/arch/powerpc/platforms/powernv/opal-xscom.c
index 262cd6fac907..748c2b97fa53 100644
--- a/arch/powerpc/platforms/powernv/opal-xscom.c
+++ b/arch/powerpc/platforms/powernv/opal-xscom.c
@@ -165,6 +165,11 @@ static int scom_debug_init_one(struct dentry *root, struct device_node *dn,
 	ent->chip = chip;
 	snprintf(ent->name, 16, "%08x", chip);
 	ent->path.data = (void *)kasprintf(GFP_KERNEL, "%pOF", dn);
+	if (!ent->path.data) {
+		kfree(ent);
+		return -ENOMEM;
+	}
+
 	ent->path.size = strlen((char *)ent->path.data);
 
 	dir = debugfs_create_dir(ent->name, root);




[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