[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6932093.x3Q0TXN2Zp@vostro.rjw.lan>
Date: Tue, 30 Jun 2015 17:09:03 +0200
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Colin King <colin.king@...onical.com>
Cc: Len Brown <lenb@...nel.org>, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ACPI / resources: fix memory leak on request_range fail path
On Monday, June 29, 2015 09:17:00 PM Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> static analysis from cppcheck detected a memory leak:
> [drivers/acpi/resource.c:664]: (error) Memory leak: reg
>
> the error path on a failed request_range call should free
> reg before returning. Bug introduced in the recent commit
> 0f1b414d190724617eb1cdd615592fa8cd9d0b50
> ("ACPI / PNP: Avoid conflicting resource reservations")
>
> Fixes: 0f1b414d19 ("ACPI / PNP: Avoid conflicting resource reservations")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
I have this fix queued up already as:
http://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/commit/?h=linux-next&id=7bc10388ccdd79b3d20463151a1f8e7a590a775b
> ---
> drivers/acpi/resource.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
> index fcb7807..10561ce 100644
> --- a/drivers/acpi/resource.c
> +++ b/drivers/acpi/resource.c
> @@ -660,8 +660,10 @@ static int add_region_before(u64 start, u64 end, u8 space_id,
> return -ENOMEM;
>
> error = request_range(start, end, space_id, flags, desc);
> - if (error)
> + if (error) {
> + kfree(reg);
> return error;
> + }
>
> reg->start = start;
> reg->end = end;
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
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