From: Matthew Tippett <matthew.tippett-rieW9WUcm8FFJ04o6PK0Fg@public.gmane.org>
To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Patch - bug in adding/removing modules
Date: Sun, 15 Dec 2002 14:23:30 -0500 [thread overview]
Message-ID: <3DFCD6B2.2050201@sympatico.ca> (raw)
[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]
Although I was only looking at the battery module, I believe I have
fixed a potential oops regarding inserting and removing modules.
The attached patch fixes a problem that I have seen, a quick look at
other modules seems to have the same problem.
The description of the problem is ...
There is a macro called acpi_device_dir which returns a pointer to the a
battery instance directory in /proc/acpi/battery. When removing a
module, the device is removed from the proc heirachy, but the entry in
the device table is never set to null. So consequently when the device
is reinserted the add_fs call already sees the proc directory entry and
consequently uses the /proc/acpi/battery and along the way corrupts some
memory.
So the patch NULLs out the proc dir entry in the device structure in a
manner symmetric with the creation and deletion of the proc directory.
Regards,
Matthew
--
Matthew Tippett - matthew.tippett-rieW9WUcm8FFJ04o6PK0Fg@public.gmane.org - (416) 435-4118
Technology Forum - http://www.technology-forum.org/
Commercial Open Source - http://www.commercialos.org/
[-- Attachment #2: battery.diff --]
[-- Type: text/plain, Size: 373 bytes --]
--- battery.c.orig 2002-12-15 14:14:51.000000000 -0500
+++ battery.c 2002-12-15 14:11:29.000000000 -0500
@@ -658,8 +658,10 @@
{
ACPI_FUNCTION_TRACE("acpi_battery_remove_fs");
- if (acpi_device_dir(device))
+ if (acpi_device_dir(device)) {
remove_proc_entry(acpi_device_bid(device), acpi_battery_dir);
+ acpi_device_dir(device) = NULL;
+ }
return_VALUE(0);
}
reply other threads:[~2002-12-15 19:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3DFCD6B2.2050201@sympatico.ca \
--to=matthew.tippett-riew9wucm8ffj04o6pk0fg@public.gmane.org \
--cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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