mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Zhen Ni <zhen.ni@easystack.cn>,
	linux-acpi@vger.kernel.org, Jassi Brar <jassisinghbrar@gmail.com>,
	Sudeep Holla <sudeep.holla@arm.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] mailbox: pcc: Add missed acpi_put_table() to fix memory leak
Date: Fri, 1 Aug 2025 16:35:47 +0200	[thread overview]
Message-ID: <7160bd86-3061-4549-abf0-074b84f4872c@web.de> (raw)
In-Reply-To: <20250730124508.939257-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.

How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16#n145


> The label name 'err' is no longer accurate because it handles both:
> 1. Error cases
> 2. Success case

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16#n94> +++ 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 out_put_pcct;
>  	}
>  
>  	chan_info = devm_kcalloc(dev, count, sizeof(*chan_info), GFP_KERNEL);
>  	if (!chan_info) {
>  		rc = -ENOMEM;
> -		goto err;
> +		goto out_put_pcct;
>  	}
>  
>  	pcc_mbox_ctrl = devm_kzalloc(dev, sizeof(*pcc_mbox_ctrl), GFP_KERNEL);
>  	if (!pcc_mbox_ctrl) {
>  		rc = -ENOMEM;
> -		goto err;
> +		goto out_put_pcct;
>  	}
…

Can such exception handling be shared by using another jump target like “e_nomem”?

Regards,
Markus

       reply	other threads:[~2025-08-01 14:35 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 ` Markus Elfring [this message]
     [not found] ` <20250804074115.44573-1-zhen.ni@easystack.cn>
2025-08-04  8:42   ` [PATCH v2] " Markus Elfring
     [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=7160bd86-3061-4549-abf0-074b84f4872c@web.de \
    --to=markus.elfring@web.de \
    --cc=jassisinghbrar@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®