netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix dm9000 release_resource
@ 2006-08-30  7:04 Dirk Opfer
  2006-08-31  9:39 ` Ben Dooks
  2006-09-06 14:58 ` Jeff Garzik
  0 siblings, 2 replies; 6+ messages in thread
From: Dirk Opfer @ 2006-08-30  7:04 UTC (permalink / raw)
  To: netdev; +Cc: Ben Dooks, Sascha Hauer

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

dm9000_release_board calls release_resource with the platform resource
instead of the requested resource:

db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
db->addr_req = request_mem_region(db->addr_res->start, i, pdev->name);

dm9000_release_board:

    if (db->addr_res != NULL) {
        release_resource(db->addr_res);
        kfree(db->addr_req);

With this behavior the kernel will crash on the second removal. The
attached patch fix this problem.


Signed-off-by: Dirk Opfer <Dirk@Opfer-Online.de>

[-- Attachment #2: dm9000-fix-release-ressource.patch --]
[-- Type: application/octet-stream, Size: 393 bytes --]

diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 3d76fa1..a860ebb 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -377,8 +377,8 @@ dm9000_release_board(struct platform_dev
 		kfree(db->data_req);
 	}
 
-	if (db->addr_res != NULL) {
-		release_resource(db->addr_res);
+	if (db->addr_req != NULL) {
+		release_resource(db->addr_req);
 		kfree(db->addr_req);
 	}
 }

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix dm9000 release_resource
       [not found] <0ML25U-1GIK8C13Mq-0007lB@mrelayeu.kundenserver.de>
@ 2006-08-31  7:32 ` Sascha Hauer
  0 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2006-08-31  7:32 UTC (permalink / raw)
  To: Dirk Opfer; +Cc: netdev, Ben Dooks

On Wed, Aug 30, 2006 at 09:04:45AM +0200, Dirk Opfer wrote:
> dm9000_release_board calls release_resource with the platform resource
> instead of the requested resource:
> 
> db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> db->addr_req = request_mem_region(db->addr_res->start, i, pdev->name);
> 
> dm9000_release_board:
> 
>     if (db->addr_res != NULL) {
>         release_resource(db->addr_res);
>         kfree(db->addr_req);
> 
> With this behavior the kernel will crash on the second removal. The
> attached patch fix this problem.
> 
> 
> Signed-off-by: Dirk Opfer <Dirk@Opfer-Online.de>

I thought this was fixed long ago, it must have been lost somewhere.
Anyway:

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>



-- 
 Dipl.-Ing. Sascha Hauer | http://www.pengutronix.de
  Pengutronix - Linux Solutions for Science and Industry
    Handelsregister: Amtsgericht Hildesheim, HRA 2686
      Hannoversche Str. 2, 31134 Hildesheim, Germany
    Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix dm9000 release_resource
  2006-08-30  7:04 [PATCH] Fix dm9000 release_resource Dirk Opfer
@ 2006-08-31  9:39 ` Ben Dooks
  2006-09-06 14:58 ` Jeff Garzik
  1 sibling, 0 replies; 6+ messages in thread
From: Ben Dooks @ 2006-08-31  9:39 UTC (permalink / raw)
  To: Dirk Opfer; +Cc: netdev, Ben Dooks, Sascha Hauer

On Wed, Aug 30, 2006 at 09:04:45AM +0200, Dirk Opfer wrote:
> dm9000_release_board calls release_resource with the platform resource
> instead of the requested resource:
> 
> db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> db->addr_req = request_mem_region(db->addr_res->start, i, pdev->name);
> 
> dm9000_release_board:
> 
>     if (db->addr_res != NULL) {
>         release_resource(db->addr_res);
>         kfree(db->addr_req);
> 
> With this behavior the kernel will crash on the second removal. The
> attached patch fix this problem.
> 
> 
> Signed-off-by: Dirk Opfer <Dirk@Opfer-Online.de>
Acked-by: Ben Dooks <ben-linux@fluff.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix dm9000 release_resource
  2006-08-30  7:04 [PATCH] Fix dm9000 release_resource Dirk Opfer
  2006-08-31  9:39 ` Ben Dooks
@ 2006-09-06 14:58 ` Jeff Garzik
  2006-09-06 17:53   ` Dirk Opfer
  1 sibling, 1 reply; 6+ messages in thread
From: Jeff Garzik @ 2006-09-06 14:58 UTC (permalink / raw)
  To: Dirk; +Cc: netdev, Ben Dooks, Sascha Hauer

Dirk Opfer wrote:
> dm9000_release_board calls release_resource with the platform resource
> instead of the requested resource:
> 
> db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> db->addr_req = request_mem_region(db->addr_res->start, i, pdev->name);
> 
> dm9000_release_board:
> 
>     if (db->addr_res != NULL) {
>         release_resource(db->addr_res);
>         kfree(db->addr_req);
> 
> With this behavior the kernel will crash on the second removal. The
> attached patch fix this problem.
> 
> 
> Signed-off-by: Dirk Opfer <Dirk@Opfer-Online.de>

Your patch is attached base64-encoded, which makes it impossible to 
comment on it inline.

	Jeff



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix dm9000 release_resource
  2006-09-06 14:58 ` Jeff Garzik
@ 2006-09-06 17:53   ` Dirk Opfer
  2006-09-11 13:08     ` Jeff Garzik
  0 siblings, 1 reply; 6+ messages in thread
From: Dirk Opfer @ 2006-09-06 17:53 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev, Ben Dooks, Sascha Hauer, dirk

[-- Attachment #1: Type: text/plain, Size: 710 bytes --]

Jeff Garzik schrieb:
>
> Your patch is attached base64-encoded, which makes it impossible to
> comment on it inline.
>
>     Jeff
>
>
Sorry for that. I send this via webclient.

Here is another attempt.

dm9000_release_board calls release_resource with the platform resource
instead of the requested resource:

db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
db->addr_req = request_mem_region(db->addr_res->start, i, pdev->name);

dm9000_release_board:

if (db->addr_res != NULL) {
release_resource(db->addr_res);
kfree(db->addr_req);

With this behavior the kernel will crash on the second removal. The
attached patch fix this problem.


Signed-off-by: Dirk Opfer <Dirk@Opfer-Online.de>


Dirk

[-- Attachment #2: dm9000-fix-release-ressource.patch --]
[-- Type: text/plain, Size: 393 bytes --]

diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 3d76fa1..a860ebb 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -377,8 +377,8 @@ dm9000_release_board(struct platform_dev
 		kfree(db->data_req);
 	}
 
-	if (db->addr_res != NULL) {
-		release_resource(db->addr_res);
+	if (db->addr_req != NULL) {
+		release_resource(db->addr_req);
 		kfree(db->addr_req);
 	}
 }

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix dm9000 release_resource
  2006-09-06 17:53   ` Dirk Opfer
@ 2006-09-11 13:08     ` Jeff Garzik
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2006-09-11 13:08 UTC (permalink / raw)
  To: Dirk Opfer; +Cc: netdev, Ben Dooks, Sascha Hauer

applied


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-09-11 13:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-30  7:04 [PATCH] Fix dm9000 release_resource Dirk Opfer
2006-08-31  9:39 ` Ben Dooks
2006-09-06 14:58 ` Jeff Garzik
2006-09-06 17:53   ` Dirk Opfer
2006-09-11 13:08     ` Jeff Garzik
     [not found] <0ML25U-1GIK8C13Mq-0007lB@mrelayeu.kundenserver.de>
2006-08-31  7:32 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).