lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 20 Nov 2007 17:43:42 +0300
From:	dmitry pervushin <dpervushin@...il.com>
To:	netdev <netdev@...r.kernel.org>
Subject: [PATCH] dm9000: fix spinlock issue and introduce platform_init
	callback

Hey all,

The patch below is intended to fix two problems:
- trying to acquire spinlock twice on timeout condition
- create callback than can be used by platform code to initialize the
chip

Signed-off-by: dmitry pervushin <dpervushin@...il.com>
Index: linux/drivers/net/dm9000.c
===================================================================
--- linux.orig/drivers/net/dm9000.c
+++ linux/drivers/net/dm9000.c
@@ -335,8 +335,11 @@ static void dm9000_timeout(struct net_de
 
 	netif_stop_queue(dev);
 	dm9000_reset(db);
+	spin_unlock_irqrestore(&db->lock,flags);
+
 	dm9000_init_dm9000(dev);
 	/* We can accept TX packets again */
+	spin_lock_irqsave(&db->lock,flags);
 	dev->trans_start = jiffies;
 	netif_wake_queue(dev);
 
@@ -526,6 +529,8 @@ dm9000_probe(struct platform_device *pde
 			db->dumpblk = pdata->dumpblk;
 	}
 
+ 	if (pdata && pdata->platform_init)
+ 			pdata->platform_init(pdev);
 	dm9000_reset(db);
 
 	/* try two times, DM9000 sometimes gets the first read wrong */
@@ -1155,10 +1160,13 @@ dm9000_drv_resume(struct platform_device
 {
 	struct net_device *ndev = platform_get_drvdata(dev);
 	board_info_t *db = (board_info_t *) ndev->priv;
+ 	struct dm9000_plat_data *pdata = dev->dev.platform_data;
 
 	if (ndev) {
 
 		if (netif_running(ndev)) {
+ 			if (pdata && pdata->platform_init)
+         	                pdata->platform_init(dev);
 			dm9000_reset(db);
 			dm9000_init_dm9000(ndev);
 
Index: linux/include/linux/dm9000.h
===================================================================
--- linux.orig/include/linux/dm9000.h
+++ linux/include/linux/dm9000.h
@@ -30,6 +30,9 @@ struct dm9000_plat_data {
 	void	(*inblk)(void __iomem *reg, void *data, int len);
 	void	(*outblk)(void __iomem *reg, void *data, int len);
 	void	(*dumpblk)(void __iomem *reg, int len);
+
+	/* platform init, if any */
+	void 	(*platform_init)(void *);
 };
 
 #endif /* __DM9000_PLATFORM_DATA */


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ