Patch "pinctrl: core: delete incorrect free in pinctrl_enable()" has been added to the 5.15-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: core: delete incorrect free in pinctrl_enable()

to the 5.15-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-core-delete-incorrect-free-in-pinctrl_enable.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 0efc745de6e053744b2fba665d3f50e70c593ca1
Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Thu Mar 21 09:38:39 2024 +0300

    pinctrl: core: delete incorrect free in pinctrl_enable()
    
    [ Upstream commit 5038a66dad0199de60e5671603ea6623eb9e5c79 ]
    
    The "pctldev" struct is allocated in devm_pinctrl_register_and_init().
    It's a devm_ managed pointer that is freed by devm_pinctrl_dev_release(),
    so freeing it in pinctrl_enable() will lead to a double free.
    
    The devm_pinctrl_dev_release() function frees the pindescs and destroys
    the mutex as well.
    
    Fixes: 6118714275f0 ("pinctrl: core: Fix pinctrl_register_and_init() with pinctrl_enable()")
    Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Message-ID: <578fbe56-44e9-487c-ae95-29b695650f7c@moroto.mountain>
    Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 456b72041c34f..1c906fc68c1df 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -2098,13 +2098,7 @@ int pinctrl_enable(struct pinctrl_dev *pctldev)
 
 	error = pinctrl_claim_hogs(pctldev);
 	if (error) {
-		dev_err(pctldev->dev, "could not claim hogs: %i\n",
-			error);
-		pinctrl_free_pindescs(pctldev, pctldev->desc->pins,
-				      pctldev->desc->npins);
-		mutex_destroy(&pctldev->mutex);
-		kfree(pctldev);
-
+		dev_err(pctldev->dev, "could not claim hogs: %i\n", error);
 		return error;
 	}
 




[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