From 519854876c66bd04b0c12d3cead6e0e5fc5a1167 Mon Sep 17 00:00:00 2001
From: Dirk Opfer <Dirk@Opfer-Online.de>
Date: Wed, 6 Sep 2006 19:53:32 +0200
Subject: [PATCH] Fix dm9000 release_resource

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>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
---
 drivers/net/dm9000.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'drivers/net')

diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 3d76fa144c4..a860ebbbf81 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -377,8 +377,8 @@ dm9000_release_board(struct platform_device *pdev, struct board_info *db)
 		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);
 	}
 }
-- 
cgit v1.2.3-18-g5258