* Patch - bug in adding/removing modules
@ 2002-12-15 19:23 Matthew Tippett
0 siblings, 0 replies; only message in thread
From: Matthew Tippett @ 2002-12-15 19:23 UTC (permalink / raw)
To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
[-- 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);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-12-15 19:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-15 19:23 Patch - bug in adding/removing modules Matthew Tippett
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.