Patch "pinctrl: devicetree: fix refcount leak in pinctrl_dt_to_map()" has been added to the 4.19-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 refcount leak in pinctrl_dt_to_map()

to the 4.19-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-refcount-leak-in-pinctrl_dt_t.patch
and it can be found in the queue-4.19 subdirectory.

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



commit 6dd2a15cfedc80e8a89350b779b4a38f7236c69c
Author: Zeng Heng <zengheng4@xxxxxxxxxx>
Date:   Mon Apr 15 18:53:28 2024 +0800

    pinctrl: devicetree: fix refcount leak in pinctrl_dt_to_map()
    
    [ Upstream commit a0cedbcc8852d6c77b00634b81e41f17f29d9404 ]
    
    If we fail to allocate propname buffer, we need to drop the reference
    count we just took. Because the pinctrl_dt_free_maps() includes the
    droping operation, here we call it directly.
    
    Fixes: 91d5c5060ee2 ("pinctrl: devicetree: fix null pointer dereferencing in pinctrl_dt_to_map")
    Suggested-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Signed-off-by: Zeng Heng <zengheng4@xxxxxxxxxx>
    Reviewed-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Message-ID: <20240415105328.3651441-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 6f5acfcba57ce..01cc09e2bccbe 100644
--- a/drivers/pinctrl/devicetree.c
+++ b/drivers/pinctrl/devicetree.c
@@ -235,14 +235,16 @@ int pinctrl_dt_to_map(struct pinctrl *p, struct pinctrl_dev *pctldev)
 	for (state = 0; ; state++) {
 		/* Retrieve the pinctrl-* property */
 		propname = kasprintf(GFP_KERNEL, "pinctrl-%d", state);
-		if (!propname)
-			return -ENOMEM;
+		if (!propname) {
+			ret = -ENOMEM;
+			goto err;
+		}
 		prop = of_find_property(np, propname, &size);
 		kfree(propname);
 		if (!prop) {
 			if (state == 0) {
-				of_node_put(np);
-				return -ENODEV;
+				ret = -ENODEV;
+				goto err;
 			}
 			break;
 		}




[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