From: Andrew Morton <akpm@linux-foundation.org>
To: Adrian Bunk <bunk@stusta.de>
Cc: lenb@kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: acpi_battery_add(): use-after-free
Date: Mon, 30 Jul 2007 15:34:20 -0700 [thread overview]
Message-ID: <20070730153420.317ae2ee.akpm@linux-foundation.org> (raw)
In-Reply-To: <20070729150046.GM16817@stusta.de>
On Sun, 29 Jul 2007 17:00:46 +0200
Adrian Bunk <bunk@stusta.de> wrote:
> The Coverity checker spotted the following use-after-free in
> acpi_battery_add():
>
> <-- snip -->
>
> ...
> static int acpi_battery_add(struct acpi_device *device)
> {
> ...
> if (result) {
> acpi_battery_remove_fs(device);
> kfree(battery);
> }
>
> mutex_unlock(&battery->mutex);
> ...
>
> <-- snip -->
>
This?
--- a/drivers/acpi/battery.c~acpi_battery_add-use-after-free
+++ a/drivers/acpi/battery.c
@@ -931,13 +931,12 @@ static int acpi_battery_add(struct acpi_
end:
+ mutex_unlock(&battery->mutex);
if (result) {
acpi_battery_remove_fs(device);
kfree(battery);
}
- mutex_unlock(&battery->mutex);
-
return result;
}
_
prev parent reply other threads:[~2007-07-30 22:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-29 15:00 acpi_battery_add(): use-after-free Adrian Bunk
2007-07-30 22:34 ` Andrew Morton [this message]
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=20070730153420.317ae2ee.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=bunk@stusta.de \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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