Skip to contentSkip to conversation

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

PATCH In review [email protected] 3 participants 10 messages Jan 15, 2021 – Mar 10, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Revert "mfd: syscon: Don't free allocated name for regmap_config"

From: Limeng <[email protected]>

This reverts commit 529a1101212a785c5df92c314b0e718287150c3b.

The reverted patch moves the memory free to error path, but introduce a memory leak. There is another commit 94cc89eb8fa5("regmap: debugfs:
Fix handling of name string for debugfs init delays") fixing this debugfs init issue from root cause. With this fixing, the name field in struct regmap_debugfs_node is removed. When initialize debugfs for syscon driver, the name field of struct regmap_config is not used anymore. So, revert this patch directly to avoid memory leak.

v2:
Notify the author of the reverted commit by adding Cc:

Fixes 529a1101212a("mfd: syscon: Don't free allocated name for regmap_config")
Cc Marc Zyngier <[email protected]>
---
 drivers/mfd/syscon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/syscon.c +1 -1
index ca465794ea9c..df5cebb372a5 100644
@@ -108,6 +108,7 @@ 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);
@@ -144,7 +145,6 @@ 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);
Signature · 1 line
2.17.1
author
#1 lore raw

Hi Marc&Lee,

Is there any comment on this patch?
Could you please help to review this patch so that I can improve it if it still has weakness?

Thanks,
Limeng

Quoted 57 lines

-----Original Message-----
From: Li, Meng <[email protected]>
Sent: Friday, January 15, 2021 9:51 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hao, Kexin <[email protected]>; Li, Meng <[email protected]>
Subject: [v2][PATCH] Revert "mfd: syscon: Don't free allocated name for regmap_config"

From: Limeng <[email protected]>

This reverts commit 529a1101212a785c5df92c314b0e718287150c3b.

The reverted patch moves the memory free to error path, but introduce a memory leak. There is another commit 94cc89eb8fa5("regmap: debugfs:
Fix handling of name string for debugfs init delays") fixing this debugfs init issue from root cause. With this fixing, the name field in struct regmap_debugfs_node is removed. When initialize debugfs for syscon driver, the name field of struct regmap_config is not used anymore. So, revert this patch directly to avoid memory leak.

v2:
Notify the author of the reverted commit by adding Cc:

Fixes 529a1101212a("mfd: syscon: Don't free allocated name for

regmap_config")

---
 drivers/mfd/syscon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/syscon.c index renamed from drivers/mfd/syscon.c +0 -0

ca465794ea9c..df5cebb372a5 100644

drivers/mfd/syscon.c +1 -0
@@ -108,6 +108,7 @@ 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");
drivers/mfd/syscon.c +0 -1
 		ret = PTR_ERR(regmap);
@@ -144,7 +145,6 @@ 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);
--
2.17.1

#2 lore raw

Hi Limeng,

Quoted 5 lines · Meng

Hi Marc&Lee,

Is there any comment on this patch?
Could you please help to review this patch so that I can improve it if it still has weakness?

If you are confident that the root issue has been fixed, no objection from me, but I'm not in a position to test it at the moment (the board I found the problem on is in a bit of a state).

Thanks,

        M.
Quoted 61 lines

Thanks,
Limeng

Quoted 57 lines

-----Original Message-----
From: Li, Meng <[email protected]>
Sent: Friday, January 15, 2021 9:51 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hao, Kexin <[email protected]>; Li, Meng <[email protected]>
Subject: [v2][PATCH] Revert "mfd: syscon: Don't free allocated name for regmap_config"

From: Limeng <[email protected]>

This reverts commit 529a1101212a785c5df92c314b0e718287150c3b.

The reverted patch moves the memory free to error path, but introduce a memory leak. There is another commit 94cc89eb8fa5("regmap: debugfs:
Fix handling of name string for debugfs init delays") fixing this debugfs init issue from root cause. With this fixing, the name field in struct regmap_debugfs_node is removed. When initialize debugfs for syscon driver, the name field of struct regmap_config is not used anymore. So, revert this patch directly to avoid memory leak.

v2:
Notify the author of the reverted commit by adding Cc:

Fixes 529a1101212a("mfd: syscon: Don't free allocated name for

regmap_config")

---
 drivers/mfd/syscon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/syscon.c index renamed from drivers/mfd/syscon.c +0 -0

ca465794ea9c..df5cebb372a5 100644

drivers/mfd/syscon.c +1 -0
@@ -108,6 +108,7 @@ 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");
drivers/mfd/syscon.c +0 -1
 		ret = PTR_ERR(regmap);
@@ -144,7 +145,6 @@ 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);
--
2.17.1

Signature · 1 line
Jazz is not dead. It just smells funny...
#3 lore raw
Quoted 5 lines · Marc Zyngier

Hi Limeng,

Quoted 2 lines · Meng

Hi Marc&Lee,

Quoted 7 lines
Quoted 3 lines

Is there any comment on this patch?
Could you please help to review this patch so that I can improve it if it still has weakness?

If you are confident that the root issue has been fixed, no objection from me, but I'm not in a position to test it at the moment (the board I found the problem on is in a bit of a state).

I'm not keen on flip-flopping this patch in and out of the kernel. Someone really needs to spend some time to map out the full life-cycle and propose a (possibly cross-subsystem) solution.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#4 lore raw

Thanks for all of your comments.

Regards,
Limeng

Quoted 34 lines

-----Original Message-----
From: Lee Jones <[email protected]>
Sent: Monday, February 22, 2021 5:21 PM
To: Marc Zyngier <[email protected]>
Cc: Li, Meng <[email protected]>; [email protected]; [email protected]; Hao, Kexin <[email protected]>
Subject: Re: [v2][PATCH] Revert "mfd: syscon: Don't free allocated name for regmap_config"

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 5 lines · Marc Zyngier

Hi Limeng,

Quoted 2 lines · Meng

Hi Marc&Lee,

Quoted 7 lines
Quoted 3 lines

Is there any comment on this patch?
Could you please help to review this patch so that I can improve it if it still has weakness?

If you are confident that the root issue has been fixed, no objection from me, but I'm not in a position to test it at the moment (the board I found the problem on is in a bit of a state).

I'm not keen on flip-flopping this patch in and out of the kernel. Someone really needs to spend some time to map out the full life-cycle and propose a (possibly cross-subsystem) solution.

--
Lee Jones [李琼斯]

Senior Technical Lead - Developer Services Linaro.org │ Open source
software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
#5 lore raw
Quoted 26 lines · Meng
Quoted 26 lines

-----Original Message-----
From: Lee Jones <[email protected]>
Sent: Monday, February 22, 2021 5:21 PM
To: Marc Zyngier <[email protected]>
Cc: Li, Meng <[email protected]>; [email protected]; [email protected]; Hao, Kexin <[email protected]>
Subject: Re: [v2][PATCH] Revert "mfd: syscon: Don't free allocated name for regmap_config"

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 12 lines · Marc Zyngier

Hi Limeng,

Quoted 5 lines · Meng

Hi Marc&Lee,

Is there any comment on this patch?
Could you please help to review this patch so that I can improve it if it still has weakness?

If you are confident that the root issue has been fixed, no objection from me, but I'm not in a position to test it at the moment (the board I found the problem on is in a bit of a state).

Quoted 5 lines
Quoted 4 lines

I'm not keen on flip-flopping this patch in and out of the kernel. Someone really needs to spend some time to map out the full life-cycle and propose a (possibly cross-subsystem) solution.

Thanks for all of your comments.

Have you looked into this further at all?

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#6 lore raw
Quoted 40 lines

-----Original Message-----
From: Lee Jones <[email protected]>
Sent: Tuesday, March 9, 2021 5:43 PM
To: Li, Meng <[email protected]>
Cc: Marc Zyngier <[email protected]>; [email protected]; [email protected]; Hao, Kexin <[email protected]>
Subject: Re: [v2][PATCH] Revert "mfd: syscon: Don't free allocated name for regmap_config"

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 26 lines · Meng
Quoted 26 lines

-----Original Message-----
From: Lee Jones <[email protected]>
Sent: Monday, February 22, 2021 5:21 PM
To: Marc Zyngier <[email protected]>
Cc: Li, Meng <[email protected]>; [email protected]; [email protected]; Hao, Kexin <[email protected]>
Subject: Re: [v2][PATCH] Revert "mfd: syscon: Don't free allocated name for regmap_config"

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 12 lines · Marc Zyngier

Hi Limeng,

Quoted 5 lines · Meng

Hi Marc&Lee,

Is there any comment on this patch?
Could you please help to review this patch so that I can improve it if it still has weakness?

If you are confident that the root issue has been fixed, no objection from me, but I'm not in a position to test it at the moment (the board I found the problem on is in a bit of a state).

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

I'm not keen on flip-flopping this patch in and out of the kernel. Someone really needs to spend some time to map out the full life-cycle and propose a (possibly cross-subsystem) solution.

Thanks for all of your comments.

Have you looked into this further at all?

No.
Maintainer expects better solution to solve this issue from frame level, and consider cross-subsystem.

Thanks,
Limeng

Quoted 4 lines

--
Lee Jones [李琼斯]

Senior Technical Lead - Developer Services Linaro.org │ Open source
software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
#7 lore raw
Quoted 44 lines · Meng
Quoted 44 lines

-----Original Message-----
From: Lee Jones <[email protected]>
Sent: Tuesday, March 9, 2021 5:43 PM
To: Li, Meng <[email protected]>
Cc: Marc Zyngier <[email protected]>; [email protected]; [email protected]; Hao, Kexin <[email protected]>
Subject: Re: [v2][PATCH] Revert "mfd: syscon: Don't free allocated name for regmap_config"

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 30 lines · Meng
Quoted 30 lines

-----Original Message-----
From: Lee Jones <[email protected]>
Sent: Monday, February 22, 2021 5:21 PM
To: Marc Zyngier <[email protected]>
Cc: Li, Meng <[email protected]>; [email protected]; [email protected]; Hao, Kexin <[email protected]>
Subject: Re: [v2][PATCH] Revert "mfd: syscon: Don't free allocated name for regmap_config"

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 5 lines · Marc Zyngier

Hi Limeng,

Quoted 2 lines · Meng

Hi Marc&Lee,

Quoted 7 lines
Quoted 3 lines

Is there any comment on this patch?
Could you please help to review this patch so that I can improve it if it still has weakness?

If you are confident that the root issue has been fixed, no objection from me, but I'm not in a position to test it at the moment (the board I found the problem on is in a bit of a state).

I'm not keen on flip-flopping this patch in and out of the kernel. Someone really needs to spend some time to map out the full life-cycle and propose a (possibly cross-subsystem) solution.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Thanks for all of your comments.

Have you looked into this further at all?

No.
Maintainer expects better solution to solve this issue from frame level, and consider cross-subsystem.

Yes, I do. Does that mean you're going to drop it?

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#8 lore raw
Quoted 62 lines

-----Original Message-----
From: Lee Jones <[email protected]>
Sent: Wednesday, March 10, 2021 2:15 AM
To: Li, Meng <[email protected]>
Cc: Marc Zyngier <[email protected]>; [email protected]; [email protected]; Hao, Kexin <[email protected]>
Subject: Re: [v2][PATCH] Revert "mfd: syscon: Don't free allocated name for regmap_config"

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 47 lines · Meng
Quoted 47 lines

-----Original Message-----
From: Lee Jones <[email protected]>
Sent: Tuesday, March 9, 2021 5:43 PM
To: Li, Meng <[email protected]>
Cc: Marc Zyngier <[email protected]>; [email protected]; [email protected]; Hao, Kexin <[email protected]>
Subject: Re: [v2][PATCH] Revert "mfd: syscon: Don't free allocated name for regmap_config"

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 32 lines · Meng
Quoted 23 lines

-----Original Message-----
From: Lee Jones <[email protected]>
Sent: Monday, February 22, 2021 5:21 PM
To: Marc Zyngier <[email protected]>
Cc: Li, Meng <[email protected]>; [email protected]; [email protected]; Hao, Kexin <[email protected]>
Subject: Re: [v2][PATCH] Revert "mfd: syscon: Don't free allocated name for regmap_config"

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 9 lines · Marc Zyngier

Hi Limeng,

Quoted 5 lines · Meng

Hi Marc&Lee,

Is there any comment on this patch?
Could you please help to review this patch so that I can improve it if it still has weakness?

Quoted 8 lines
Quoted 3 lines

If you are confident that the root issue has been fixed, no objection from me, but I'm not in a position to test it at the moment (the board I found the problem on is in a bit of a state).

I'm not keen on flip-flopping this patch in and out of the kernel. Someone really needs to spend some time to map out the full life-cycle and propose a (possibly cross-subsystem) solution.

Thanks for all of your comments.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Have you looked into this further at all?

No.
Maintainer expects better solution to solve this issue from frame level, and

consider cross-subsystem.

Yes, I do. Does that mean you're going to drop it?

Thanks for fixing this issue.
Please discard my patch, I will not do further effort and drop it.

Thanks,
Limeng

Quoted 4 lines

--
Lee Jones [李琼斯]

Senior Technical Lead - Developer Services Linaro.org │ Open source
software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
#9 lore raw
Quoted 67 lines · Meng
Quoted 67 lines

-----Original Message-----
From: Lee Jones <[email protected]>
Sent: Wednesday, March 10, 2021 2:15 AM
To: Li, Meng <[email protected]>
Cc: Marc Zyngier <[email protected]>; [email protected]; [email protected]; Hao, Kexin <[email protected]>
Subject: Re: [v2][PATCH] Revert "mfd: syscon: Don't free allocated name for regmap_config"

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 52 lines · Meng
Quoted 41 lines

-----Original Message-----
From: Lee Jones <[email protected]>
Sent: Tuesday, March 9, 2021 5:43 PM
To: Li, Meng <[email protected]>
Cc: Marc Zyngier <[email protected]>; [email protected]; [email protected]; Hao, Kexin <[email protected]>
Subject: Re: [v2][PATCH] Revert "mfd: syscon: Don't free allocated name for regmap_config"

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 27 lines · Meng
Quoted 27 lines

-----Original Message-----
From: Lee Jones <[email protected]>
Sent: Monday, February 22, 2021 5:21 PM
To: Marc Zyngier <[email protected]>
Cc: Li, Meng <[email protected]>; [email protected]; [email protected]; Hao, Kexin <[email protected]>
Subject: Re: [v2][PATCH] Revert "mfd: syscon: Don't free allocated name for regmap_config"

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 12 lines · Marc Zyngier

Hi Limeng,

Quoted 5 lines · Meng

Hi Marc&Lee,

Is there any comment on this patch?
Could you please help to review this patch so that I can improve it if it still has weakness?

If you are confident that the root issue has been fixed, no objection from me, but I'm not in a position to test it at the moment (the board I found the problem on is in a bit of a state).

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

I'm not keen on flip-flopping this patch in and out of the kernel. Someone really needs to spend some time to map out the full life-cycle and propose a (possibly cross-subsystem) solution.

Thanks for all of your comments.

Have you looked into this further at all?

No.
Maintainer expects better solution to solve this issue from frame level, and

Quoted 7 lines
Quoted 4 lines

consider cross-subsystem.

Yes, I do. Does that mean you're going to drop it?

Thanks for fixing this issue.
Please discard my patch, I will not do further effort and drop it.

For the record, this has not been fixed.

Someone still needs to work on a suitable fix for this issue.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog