From: Vasily Averin <vvs@sw.ru>
To: Len Brown <len.brown@intel.com>,
linux-acpi@vger.kernel.org, Kirill Korotaev <dev@sw.ru>,
devel@openvz.org
Subject: [PATCH ACPI] memory leakages in driver/acpi/video.c
Date: Sun, 09 Apr 2006 19:09:15 +0400 [thread overview]
Message-ID: <4439239B.7040800@sw.ru> (raw)
[-- Attachment #1: Type: text/plain, Size: 459 bytes --]
Unlike my previously patches this one is not trivial and it is not tested
properly. I'm not an expert in ACPI-related questions therefore this patch may
be wrong.
Len, could you please check it carefully?
acpi_video_bus_get_one_device() and other functions in driver/acpi/video.c do
not release allocated memory on remove and on the error path.
Signed-off-by: Vasily Averin <vvs@sw.ru>
Thank you,
Vasily Averin
SWsoft Virtuozzo/OpenVZ Linux kernel team
[-- Attachment #2: diff-ms-acpi-video-20060409 --]
[-- Type: text/plain, Size: 1677 bytes --]
--- a/drivers/acpi/video.c 2006-03-20 08:53:29.000000000 +0300
+++ b/drivers/acpi/video.c 2006-04-09 18:34:38.000000000 +0400
@@ -1294,7 +1294,7 @@ acpi_video_bus_get_one_device(struct acp
struct acpi_video_bus *video)
{
unsigned long device_id;
- int status, result;
+ int status;
struct acpi_video_device *data;
ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device");
@@ -1346,8 +1346,11 @@ acpi_video_bus_get_one_device(struct acp
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error installing notify handler\n"));
- result = -ENODEV;
- goto end;
+ if(data->brightness)
+ kfree(data->brightness->levels);
+ kfree(data->brightness);
+ kfree(data);
+ return_VALUE(-ENODEV);
}
down(&video->sem);
@@ -1358,8 +1361,6 @@ acpi_video_bus_get_one_device(struct acp
return_VALUE(0);
}
-
- end:
return_VALUE(-ENOENT);
}
@@ -1643,8 +1644,9 @@ static int acpi_video_bus_put_devices(st
printk(KERN_WARNING PREFIX
"hhuuhhuu bug in acpi video driver.\n");
+ if (data->brightness);
+ kfree(data->brightness->levels);
kfree(data->brightness);
-
kfree(data);
}
@@ -1785,6 +1787,10 @@ static int acpi_video_bus_add(struct acp
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error installing notify handler\n"));
+ acpi_video_bus_stop_devices(video);
+ acpi_video_bus_put_devices(video);
+ kfree(video->attached_array);
+ acpi_video_bus_remove_fs(device);
result = -ENODEV;
goto end;
}
@@ -1797,7 +1803,6 @@ static int acpi_video_bus_add(struct acp
end:
if (result) {
- acpi_video_bus_remove_fs(device);
kfree(video);
}
next reply other threads:[~2006-04-09 15:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-09 15:09 Vasily Averin [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-04-10 2:23 [PATCH ACPI] memory leakages in driver/acpi/video.c Yu, Luming
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=4439239B.7040800@sw.ru \
--to=vvs@sw.ru \
--cc=dev@sw.ru \
--cc=devel@openvz.org \
--cc=len.brown@intel.com \
--cc=linux-acpi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.