Patch "gpio: grgpio: Add NULL check in grgpio_probe" has been added to the 5.10-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

    gpio: grgpio: Add NULL check in grgpio_probe

to the 5.10-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:
     gpio-grgpio-add-null-check-in-grgpio_probe.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 667f17dab82b3fd9b98c8bfc39d0ce80780589b5
Author: Charles Han <hanchunchao@xxxxxxxxxx>
Date:   Thu Nov 14 17:18:22 2024 +0800

    gpio: grgpio: Add NULL check in grgpio_probe
    
    [ Upstream commit 050b23d081da0f29474de043e9538c1f7a351b3b ]
    
    devm_kasprintf() can return a NULL pointer on failure,but this
    returned value in grgpio_probe is not checked.
    Add NULL check in grgpio_probe, to handle kernel NULL
    pointer dereference error.
    
    Cc: stable@xxxxxxxxxxxxxxx
    Fixes: 7eb6ce2f2723 ("gpio: Convert to using %pOF instead of full_name")
    Signed-off-by: Charles Han <hanchunchao@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241114091822.78199-1-hanchunchao@xxxxxxxxxx
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpio/gpio-grgpio.c b/drivers/gpio/gpio-grgpio.c
index ca3bf8d51d5aa..506891115bb3e 100644
--- a/drivers/gpio/gpio-grgpio.c
+++ b/drivers/gpio/gpio-grgpio.c
@@ -363,6 +363,9 @@ static int grgpio_probe(struct platform_device *ofdev)
 	gc->owner = THIS_MODULE;
 	gc->to_irq = grgpio_to_irq;
 	gc->label = devm_kasprintf(dev, GFP_KERNEL, "%pOF", np);
+	if (!gc->label)
+		return -ENOMEM;
+
 	gc->base = -1;
 
 	err = of_property_read_u32(np, "nbits", &prop);




[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