All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>,
	Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>,
	Greg KH <greg@kroah.com>
Subject: [PATCH 2.6] Fix OOPS in device_platform_unregister
Date: Sat, 10 Jul 2004 22:13:39 -0500	[thread overview]
Message-ID: <200407102213.39422.dtor_core@ameritech.net> (raw)

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);
 	}
 }
 

             reply	other threads:[~2004-07-11  3:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-11  3:13 Dmitry Torokhov [this message]
2004-07-14 23:04 ` [PATCH 2.6] Fix OOPS in device_platform_unregister Greg KH

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=200407102213.39422.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=akpm@osdl.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vda@port.imtp.ilyichevsk.odessa.ua \
    /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.