Add kfree() for "d->main_status_buf" in the error-handling path to prevent a memory leak.
Fixes: a2d21848d921 ("regmap: regmap-irq: Add main status register support") Cc: stable@vger.kernel.org Signed-off-by: Jiasheng Jiang jiashengjiangcool@gmail.com --- drivers/base/regmap/regmap-irq.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 0bcd81389a29..b73ab3cda781 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -906,6 +906,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, kfree(d->wake_buf); kfree(d->mask_buf_def); kfree(d->mask_buf); + kfree(d->main_status_buf); kfree(d->status_buf); kfree(d->status_reg_buf); if (d->config_buf) {
On Sun, Feb 02, 2025 at 08:05:12PM +0000, Jiasheng Jiang wrote:
Add kfree() for "d->main_status_buf" in the error-handling path to prevent a memory leak.
Fixes: a2d21848d921 ("regmap: regmap-irq: Add main status register support") Cc: stable@vger.kernel.org Signed-off-by: Jiasheng Jiang jiashengjiangcool@gmail.com
drivers/base/regmap/regmap-irq.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 0bcd81389a29..b73ab3cda781 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -906,6 +906,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, kfree(d->wake_buf); kfree(d->mask_buf_def); kfree(d->mask_buf);
- kfree(d->main_status_buf); kfree(d->status_buf); kfree(d->status_reg_buf); if (d->config_buf) {
-- 2.25.1
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.
You are receiving this message because of the following common error(s) as indicated below:
- This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/process/submitting-patches.rst for what needs to be done here to properly describe this.
If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.
thanks,
greg k-h's patch email bot
Add kfree() for "d->main_status_buf" in the error-handling path to prevent a memory leak.
Fixes: a2d21848d921 ("regmap: regmap-irq: Add main status register support") Cc: stable@vger.kernel.org # v5.1+ Signed-off-by: Jiasheng Jiang jiashengjiangcool@gmail.com --- Changelog:
v1 -> v2:
1. Add a cc: stable line. --- drivers/base/regmap/regmap-irq.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 0bcd81389a29..b73ab3cda781 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -906,6 +906,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, kfree(d->wake_buf); kfree(d->mask_buf_def); kfree(d->mask_buf); + kfree(d->main_status_buf); kfree(d->status_buf); kfree(d->status_reg_buf); if (d->config_buf) {
Thanks Jiang!
On 02/02/2025 22:05, Jiasheng Jiang wrote:
Add kfree() for "d->main_status_buf" in the error-handling path to prevent a memory leak.
Fixes: a2d21848d921 ("regmap: regmap-irq: Add main status register support") Cc: stable@vger.kernel.org Signed-off-by: Jiasheng Jiang jiashengjiangcool@gmail.com
This looks valid to me.
I still wonder if you could fix also the missing freeing from the regmap_del_irq_chip()? (AFAICS, the freeing is missing from that as well).
drivers/base/regmap/regmap-irq.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 0bcd81389a29..b73ab3cda781 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -906,6 +906,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, kfree(d->wake_buf); kfree(d->mask_buf_def); kfree(d->mask_buf);
- kfree(d->main_status_buf); kfree(d->status_buf); kfree(d->status_reg_buf); if (d->config_buf) {
Add kfree() for "d->main_status_buf" to the error-handling path to prevent a memory leak.
Fixes: a2d21848d921 ("regmap: regmap-irq: Add main status register support") Cc: stable@vger.kernel.org # v5.1+ Signed-off-by: Jiasheng Jiang jiashengjiangcool@gmail.com --- Changelog:
v2 -> v3:
1. Add kfree() to regmap_del_irq_chip().
v1 -> v2:
1. Add a cc: stable line. --- drivers/base/regmap/regmap-irq.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 0bcd81389a29..978613407ea3 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -906,6 +906,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, kfree(d->wake_buf); kfree(d->mask_buf_def); kfree(d->mask_buf); + kfree(d->main_status_buf); kfree(d->status_buf); kfree(d->status_reg_buf); if (d->config_buf) { @@ -981,6 +982,7 @@ void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *d) kfree(d->wake_buf); kfree(d->mask_buf_def); kfree(d->mask_buf); + kfree(d->main_status_buf); kfree(d->status_reg_buf); kfree(d->status_buf); if (d->config_buf) {
On Wed, 05 Feb 2025 00:43:43 +0000, Jiasheng Jiang wrote:
Add kfree() for "d->main_status_buf" to the error-handling path to prevent a memory leak.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next
Thanks!
[1/1] regmap-irq: Add missing kfree() commit: 32ffed055dcee17f6705f545b069e44a66067808
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
Hi Matti,
On Tue, Feb 4, 2025 at 3:34 AM Matti Vaittinen mazziesaccount@gmail.com wrote:
Thanks Jiang!
On 02/02/2025 22:05, Jiasheng Jiang wrote:
Add kfree() for "d->main_status_buf" in the error-handling path to prevent a memory leak.
Fixes: a2d21848d921 ("regmap: regmap-irq: Add main status register support") Cc: stable@vger.kernel.org Signed-off-by: Jiasheng Jiang jiashengjiangcool@gmail.com
This looks valid to me.
I still wonder if you could fix also the missing freeing from the regmap_del_irq_chip()? (AFAICS, the freeing is missing from that as well).
Thanks for your help. I have submitted a v2 to fix it.
-Jiasheng
drivers/base/regmap/regmap-irq.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 0bcd81389a29..b73ab3cda781 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -906,6 +906,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, kfree(d->wake_buf); kfree(d->mask_buf_def); kfree(d->mask_buf);
kfree(d->main_status_buf); kfree(d->status_buf); kfree(d->status_reg_buf); if (d->config_buf) {
On Sun, 02 Feb 2025 20:05:12 +0000, Jiasheng Jiang wrote:
Add kfree() for "d->main_status_buf" in the error-handling path to prevent a memory leak.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next
Thanks!
[1/1] regmap-irq: Add missing kfree() commit: 32ffed055dcee17f6705f545b069e44a66067808
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
linux-stable-mirror@lists.linaro.org