[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTimQPSWFCxhBXPNrCokCkYc3dOoorVCQXxSlsBuE@mail.gmail.com>
Date: Tue, 29 Jun 2010 07:30:22 +0200
From: Corentin Chary <corentin.chary@...il.com>
To: Axel Lin <axel.lin@...il.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
Matthew Garrett <mjg@...hat.com>,
Len Brown <len.brown@...el.com>,
Alan Jenkins <alan-jenkins@...fmail.co.uk>,
acpi4asus-user@...ts.sourceforge.net,
platform-driver-x86@...r.kernel.org
Subject: Re: [PATCH] asus-laptop: fix a memory leak in asus_laptop_get_info
error path
On Tue, Jun 29, 2010 at 5:09 AM, Axel Lin <axel.lin@...il.com> wrote:
> The callers of write_acpi_int_ret() pass ACPI_ALLOCATE_BUFFER,
> the caller must kfree the returned buffer if AE_OK is returned.
>
> This patch adds a missing kfree(buffer.pointer) before return -ENOMEM
> if kstrdup fail.
>
> Signed-off-by: Axel Lin <axel.lin@...il.com>
> ---
> drivers/platform/x86/asus-laptop.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
> index 71db2ef..3d76c6a 100644
> --- a/drivers/platform/x86/asus-laptop.c
> +++ b/drivers/platform/x86/asus-laptop.c
> @@ -1397,8 +1397,10 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
> }
> }
> asus->name = kstrdup(string, GFP_KERNEL);
> - if (!asus->name)
> + if (!asus->name) {
> + kfree(buffer.pointer);
> return -ENOMEM;
> + }
>
> if (*string)
> pr_notice(" %s model detected\n", string);
> --
> 1.5.4.3
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Acked-by: Corentin Chary <corentincj@...aif.net>
--
Corentin Chary
http://xf.iksaif.net
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists