From: Chuck Ebbert <cebbert@redhat.com>
To: kristen.c.accardi@intel.com
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: kernel oops after ACPI dock initialization fails
Date: Tue, 08 May 2007 17:54:40 -0400 [thread overview]
Message-ID: <4640F1A0.6050700@redhat.com> (raw)
In-Reply-To: <4640EF28.2000903@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 589 bytes --]
Chuck Ebbert wrote:
> In 2.6.21.1 when dock driver initialization fails it does a kfree()
> of dock_station. (Below, this is due to some error installing a
> notify handler.) Later when a bay is discovered it calls
> is_dock_device() which attempts to lock the (nonexistent)
> dock_station. Reason is this test in is_dock_device():
>
> if (!dock_station)
> return 0;
>
> dock_station is 0x6b6b6b6b after being freed. Either it needs
> to be zeroed or some other flag should be used to decide
> whether a dock station is present...
>
Untested patch attached.
[-- Attachment #2: acpi_fix_bay-dock_oops.patch --]
[-- Type: text/plain, Size: 1520 bytes --]
---
drivers/acpi/dock.c | 6 ++++++
1 file changed, 6 insertions(+)
--- 2.6.21-d390.orig/drivers/acpi/dock.c
+++ 2.6.21-d390/drivers/acpi/dock.c
@@ -698,6 +698,7 @@ static int dock_add(acpi_handle handle)
if (ret) {
printk(KERN_ERR PREFIX "Error %d registering dock device\n", ret);
kfree(dock_station);
+ dock_station = NULL;
return ret;
}
ret = device_create_file(&dock_device.dev, &dev_attr_docked);
@@ -705,6 +706,7 @@ static int dock_add(acpi_handle handle)
printk("Error %d adding sysfs file\n", ret);
platform_device_unregister(&dock_device);
kfree(dock_station);
+ dock_station = NULL;
return ret;
}
ret = device_create_file(&dock_device.dev, &dev_attr_undock);
@@ -713,6 +715,7 @@ static int dock_add(acpi_handle handle)
device_remove_file(&dock_device.dev, &dev_attr_docked);
platform_device_unregister(&dock_device);
kfree(dock_station);
+ dock_station = NULL;
return ret;
}
@@ -725,6 +728,7 @@ static int dock_add(acpi_handle handle)
dd = alloc_dock_dependent_device(handle);
if (!dd) {
kfree(dock_station);
+ dock_station = NULL;
ret = -ENOMEM;
goto dock_add_err_unregister;
}
@@ -752,6 +756,7 @@ dock_add_err_unregister:
device_remove_file(&dock_device.dev, &dev_attr_undock);
platform_device_unregister(&dock_device);
kfree(dock_station);
+ dock_station = NULL;
return ret;
}
@@ -785,6 +790,7 @@ static int dock_remove(void)
/* free dock station memory */
kfree(dock_station);
+ dock_station = NULL;
return 0;
}
next prev parent reply other threads:[~2007-05-08 21:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-08 21:44 kernel oops after ACPI dock initialization fails Chuck Ebbert
2007-05-08 21:54 ` Chuck Ebbert [this message]
2007-05-08 22:29 ` Kristen Carlson Accardi
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=4640F1A0.6050700@redhat.com \
--to=cebbert@redhat.com \
--cc=kristen.c.accardi@intel.com \
--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