From: Toshi Kani <toshi.kani@hp.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Len Brown <lenb@kernel.org>, "Rafael J. Wysocki" <rjw@sisk.pl>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
Larry Finger <Larry.Finger@lwfinger.net>
Subject: Re: [PATCH] acpi: Fix memory leak on acpi_scan_init_hotplug() error path
Date: Wed, 15 May 2013 12:21:11 -0600 [thread overview]
Message-ID: <1368642071.5673.37.camel@misato.fc.hp.com> (raw)
In-Reply-To: <1368636575-5480-1-git-send-email-catalin.marinas@arm.com>
On Wed, 2013-05-15 at 17:49 +0100, Catalin Marinas wrote:
> Following commit 6b772e8f9 (ACPI: Update PNPID match handling for
> notify), the acpi_scan_init_hotplug() calls acpi_set_pnp_ids() which
> allocates acpi_hardware_id and copies a few strings (kstrdup). If the
> devices does not have hardware_id set, the function exits without
> freeing the previously allocated ids (and kmemleak complains). This
> patch calls simply changes 'return' on error to a 'goto out' which calls
> acpi_free_pnp_ids().
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Reported-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Toshi Kani <toshi.kani@hp.com>
Reviewed-by: Toshi Kani <toshi.kani@hp.com>
Tested-by: Toshi Kani <toshi.kani@hp.com>
Testing was performed by adding a fake ACPI object with _UID only.
Thanks,
-Toshi
> ---
> drivers/acpi/scan.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index fe158fd..c1bc608 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -1785,7 +1785,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type)
> acpi_set_pnp_ids(handle, &pnp, type);
>
> if (!pnp.type.hardware_id)
> - return;
> + goto out;
>
> /*
> * This relies on the fact that acpi_install_notify_handler() will not
> @@ -1800,6 +1800,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type)
> }
> }
>
> +out:
> acpi_free_pnp_ids(&pnp);
> }
>
next prev parent reply other threads:[~2013-05-15 18:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-15 16:49 Catalin Marinas
2013-05-15 18:21 ` Toshi Kani [this message]
2013-05-15 20:48 ` Rafael J. Wysocki
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=1368642071.5673.37.camel@misato.fc.hp.com \
--to=toshi.kani@hp.com \
--cc=Larry.Finger@lwfinger.net \
--cc=catalin.marinas@arm.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@sisk.pl \
/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®