* [PATCH 2.6] Fix OOPS in device_platform_unregister
@ 2004-07-11 3:13 Dmitry Torokhov
2004-07-14 23:04 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Torokhov @ 2004-07-11 3:13 UTC (permalink / raw)
To: linux-kernel; +Cc: Andrew Morton, Denis Vlasenko, Greg KH
Hi,
The following patch should fix the oops reported by Denis. We can safely
move call to device_unregister as the release fucntion is not guaranteed
to be called immediately and therefore should not access resources anyway.
--
Dmitry
===================================================================
ChangeSet@1.1819, 2004-07-10 22:08:01-05:00, dtor_core@ameritech.net
Driver core: platform_device_unregister should release resources first
and only then call device_unregister, otherwise if there
are no more references to the device it will be freed and
the fucntion will try to access freed memory.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
platform.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
diff -Nru a/drivers/base/platform.c b/drivers/base/platform.c
--- a/drivers/base/platform.c 2004-07-10 22:09:10 -05:00
+++ b/drivers/base/platform.c 2004-07-10 22:09:10 -05:00
@@ -146,13 +146,13 @@
int i;
if (pdev) {
- device_unregister(&pdev->dev);
-
for (i = 0; i < pdev->num_resources; i++) {
struct resource *r = &pdev->resource[i];
if (r->flags & (IORESOURCE_MEM|IORESOURCE_IO))
release_resource(r);
}
+
+ device_unregister(&pdev->dev);
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2.6] Fix OOPS in device_platform_unregister
2004-07-11 3:13 [PATCH 2.6] Fix OOPS in device_platform_unregister Dmitry Torokhov
@ 2004-07-14 23:04 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2004-07-14 23:04 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-kernel, Andrew Morton, Denis Vlasenko
On Sat, Jul 10, 2004 at 10:13:39PM -0500, Dmitry Torokhov wrote:
> Hi,
>
> The following patch should fix the oops reported by Denis. We can safely
> move call to device_unregister as the release fucntion is not guaranteed
> to be called immediately and therefore should not access resources anyway.
Applied, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-07-14 23:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-11 3:13 [PATCH 2.6] Fix OOPS in device_platform_unregister Dmitry Torokhov
2004-07-14 23:04 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox