Patch "pinctrl: devicetree: fix null pointer dereferencing in pinctrl_dt_to_map" 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

    pinctrl: devicetree: fix null pointer dereferencing in pinctrl_dt_to_map

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:
     pinctrl-devicetree-fix-null-pointer-dereferencing-in.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 0d688106c3a31709aac26a41832a9ad0ab3f5f66
Author: Zeng Heng <zengheng4@xxxxxxxxxx>
Date:   Thu Nov 10 16:20:56 2022 +0800

    pinctrl: devicetree: fix null pointer dereferencing in pinctrl_dt_to_map
    
    [ Upstream commit 91d5c5060ee24fe8da88cd585bb43b843d2f0dce ]
    
    Here is the BUG report by KASAN about null pointer dereference:
    
    BUG: KASAN: null-ptr-deref in strcmp+0x2e/0x50
    Read of size 1 at addr 0000000000000000 by task python3/2640
    Call Trace:
     strcmp
     __of_find_property
     of_find_property
     pinctrl_dt_to_map
    
    kasprintf() would return NULL pointer when kmalloc() fail to allocate.
    So directly return ENOMEM, if kasprintf() return NULL pointer.
    
    Fixes: 57291ce295c0 ("pinctrl: core device tree mapping table parsing support")
    Signed-off-by: Zeng Heng <zengheng4@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221110082056.2014898-1-zengheng4@xxxxxxxxxx
    Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c
index d32aedfc6dd0..29f8abffe99f 100644
--- a/drivers/pinctrl/devicetree.c
+++ b/drivers/pinctrl/devicetree.c
@@ -207,6 +207,8 @@ int pinctrl_dt_to_map(struct pinctrl *p)
 	for (state = 0; ; state++) {
 		/* Retrieve the pinctrl-* property */
 		propname = kasprintf(GFP_KERNEL, "pinctrl-%d", state);
+		if (!propname)
+			return -ENOMEM;
 		prop = of_find_property(np, propname, &size);
 		kfree(propname);
 		if (!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