Skip to contentSkip to conversation

dm9000: do not kfree() netdevice

PATCH In review Ben Dooks 1 participant 2 messages Feb 12, 2007 – Feb 16, 2007

Subsystems (2)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 dm9000: do not kfree() netdevice

The DM9000 network driver is calling kfree() on an netdev causing the system to oops if the probe fails. The right thing to do is call free_netdev().

Thanks to Russell King for spotting this.

drivers/net/dm9000.c +2 -2
diff -urpN -X ../dontdiff linux-2.6.20/drivers/net/dm9000.c linux-2.6.20-dmfix/drivers/net/dm9000.c
@@ -601,7 +601,7 @@ dm9000_probe(struct platform_device *pde
 	printk("%s: not found (%d).\n", CARDNAME, ret);
 
 	dm9000_release_board(pdev, db);
-	kfree(ndev);
+	free_netdev(ndev);
 
 	return ret;
 }
@@ -1194,7 +1194,7 @@ dm9000_drv_remove(struct platform_device
 
 	unregister_netdev(ndev);
 	dm9000_release_board(pdev, (board_info_t *) ndev->priv);
-	kfree(ndev);		/* free device structure */
+	free_netdev(ndev);		/* free device structure */
 
 	PRINTK1("clean_module() exit\n");
 
author
#1 lore raw
Quoted 21 lines · Ben Dooks

The DM9000 network driver is calling kfree() on an netdev causing the system to oops if the probe fails. The right thing to do is call free_netdev().

Thanks to Russell King for spotting this.

diff -urpN -X ../dontdiff linux-2.6.20/drivers/net/dm9000.c linux-2.6.20-dmfix/drivers/net/dm9000.c

drivers/net/dm9000.c +1 -1
@@ -601,7 +601,7 @@ dm9000_probe(struct platform_device *pde
 	printk("%s: not found (%d).\n", CARDNAME, ret);
 
 	dm9000_release_board(pdev, db);
-	kfree(ndev);
+	free_netdev(ndev);
 
 	return ret;
 }

drivers/net/dm9000.c dm9000_drv_remove(struct platform_device · line 1199

Quoted 7 lines
drivers/net/dm9000.c +1 -1
@@ -1194,7 +1194,7 @@ dm9000_drv_remove(struct platform_device
 
 	unregister_netdev(ndev);
 	dm9000_release_board(pdev, (board_info_t *) ndev->priv);
-	kfree(ndev);		/* free device structure */
+	free_netdev(ndev);		/* free device structure */
 
 	PRINTK1("clean_module() exit\n");

Do I need to send this patch to a particual person to ensure that it gets included into the kernel?

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'