From: Markus Elfring <Markus.Elfring@web.de>
To: Zhen Ni <zhen.ni@easystack.cn>, linux-acpi@vger.kernel.org
Cc: stable@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Jassi Brar <jassisinghbrar@gmail.com>,
Sudeep Holla <sudeep.holla@arm.com>
Subject: Re: [PATCH v2] mailbox: pcc: Add missed acpi_put_table() to fix memory leak
Date: Mon, 4 Aug 2025 10:42:34 +0200 [thread overview]
Message-ID: <43362d25-5be8-4158-bda2-2c8e9c4743f4@web.de> (raw)
In-Reply-To: <20250804074115.44573-1-zhen.ni@easystack.cn>
> In pcc_mbox_probe(), the PCCT table acquired via acpi_get_table()
> is only released in error paths but not in the success path. This
> leads to a permanent ACPI memory leak when the driver successfully
> initializes.
* You may occasionally put more than 66 characters into text lines
of such a change description.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16#n658
* See also once more:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16#n94
…> ---
> Changes in v2:
> - Add tags of 'Fixes' and 'Cc'
> - Change goto target from out_put_pcct to e_nomem
…> +++ b/drivers/mailbox/pcc.c
> @@ -763,19 +763,19 @@ static int pcc_mbox_probe(struct platform_device *pdev)
> GFP_KERNEL);
> if (!pcc_mbox_channels) {
> rc = -ENOMEM;
> - goto err;
> + goto e_nomem;
> }
…
Why do you not move the assignment statement accordingly?
…> @@ -796,17 +796,17 @@ static int pcc_mbox_probe(struct platform_device *pdev)
> !pcc_mbox_ctrl->txdone_irq) {
> pr_err("Platform Interrupt flag must be set to 1");
> rc = -EINVAL;
> - goto err;
> + goto e_nomem;
> }
…
You misunderstood one of my development suggestions.
…> @@ -827,9 +827,8 @@ static int pcc_mbox_probe(struct platform_device *pdev)
…> - return 0;
> -err:
> +
> +e_nomem:
> acpi_put_table(pcct_tbl);
> return rc;
> }
Would an other code variant be more reasonable?
e_nomem:
rc = -ENOMEM;
goto err;
Regards,
Markus
next prev parent reply other threads:[~2025-08-04 8:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250730124508.939257-1-zhen.ni@easystack.cn>
2025-08-01 14:35 ` [PATCH] mailbox: pcc: Add missed acpi_put_table() to fix memory leak Markus Elfring
[not found] ` <20250804074115.44573-1-zhen.ni@easystack.cn>
2025-08-04 8:42 ` Markus Elfring [this message]
[not found] ` <20250804121453.75525-1-zhen.ni@easystack.cn>
2025-08-04 14:06 ` [PATCH v3] " Markus Elfring
[not found] ` <20250805034829.168187-1-zhen.ni@easystack.cn>
2025-08-05 6:28 ` [PATCH v4] " Markus Elfring
2025-08-05 7:26 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43362d25-5be8-4158-bda2-2c8e9c4743f4@web.de \
--to=markus.elfring@web.de \
--cc=jassisinghbrar@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=sudeep.holla@arm.com \
--cc=zhen.ni@easystack.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).