Patch "mfd: syscon: Don't free allocated name for regmap_config" has been added to the 5.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

    mfd: syscon: Don't free allocated name for regmap_config

to the 5.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:
     mfd-syscon-don-t-free-allocated-name-for-regmap_conf.patch
and it can be found in the queue-5.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 165723a5be74866f65f01a3cf2354395388db967
Author: Marc Zyngier <maz@xxxxxxxxxx>
Date:   Thu Sep 3 17:02:37 2020 +0100

    mfd: syscon: Don't free allocated name for regmap_config
    
    [ Upstream commit 529a1101212a785c5df92c314b0e718287150c3b ]
    
    The name allocated for the regmap_config structure is freed
    pretty early, right after the registration of the MMIO region.
    
    Unfortunately, that doesn't follow the life cycle that debugfs
    expects, as it can access the name field long after the free
    has occurred.
    
    Move the free on the error path, and keep it forever otherwise.
    
    Fixes: e15d7f2b81d2 ("mfd: syscon: Use a unique name with regmap_config")
    Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
    Signed-off-by: Lee Jones <lee.jones@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index df5cebb372a59..ca465794ea9c8 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -108,7 +108,6 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
 	syscon_config.max_register = resource_size(&res) - reg_io_width;
 
 	regmap = regmap_init_mmio(NULL, base, &syscon_config);
-	kfree(syscon_config.name);
 	if (IS_ERR(regmap)) {
 		pr_err("regmap init failed\n");
 		ret = PTR_ERR(regmap);
@@ -145,6 +144,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
 	regmap_exit(regmap);
 err_regmap:
 	iounmap(base);
+	kfree(syscon_config.name);
 err_map:
 	kfree(syscon);
 	return ERR_PTR(ret);



[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