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>] [day] [month] [year] [list]
Date:	Sat, 17 Mar 2007 20:08:42 +1100 (EST)
From:	Finn Thain <fthain@...egraphics.com.au>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
cc:	Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
	netdev@...r.kernel.org, linux-m68k@...r.kernel.org
Subject: [PATCH 12/13] small SONIC fix and cleanup


Fix a potential problem in the timeout handling: don't free the DMA 
buffers before resetting the chip.

Also a trivial cleanup. Bring macsonic and jazzsonic into sync.

Signed-off-by: Finn Thain <fthain@...egraphics.com.au>

 drivers/net/jazzsonic.c |    4 ++--
 drivers/net/macsonic.c  |   17 ++++++++---------
 drivers/net/sonic.c     |    7 ++++++-
 3 files changed, 16 insertions(+), 12 deletions(-)

Index: linux-2.6.20/drivers/net/jazzsonic.c
===================================================================
--- linux-2.6.20.orig/drivers/net/jazzsonic.c	2007-03-05 15:19:48.000000000 +1100
+++ linux-2.6.20/drivers/net/jazzsonic.c	2007-03-05 15:20:51.000000000 +1100
@@ -269,11 +269,11 @@ static int __devexit jazz_sonic_device_r
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct sonic_local* lp = netdev_priv(dev);
 
-	unregister_netdev (dev);
+	unregister_netdev(dev);
 	dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
 	                  lp->descriptors, lp->descriptors_laddr);
 	release_region (dev->base_addr, SONIC_MEM_SIZE);
-	free_netdev (dev);
+	free_netdev(dev);
 
 	return 0;
 }
Index: linux-2.6.20/drivers/net/macsonic.c
===================================================================
--- linux-2.6.20.orig/drivers/net/macsonic.c	2007-03-05 15:20:34.000000000 +1100
+++ linux-2.6.20/drivers/net/macsonic.c	2007-03-05 15:20:51.000000000 +1100
@@ -525,7 +525,7 @@ int __init mac_nubus_sonic_probe(struct 
 	return macsonic_init(dev);
 }
 
-static int __init mac_sonic_probe(struct platform_device *device)
+static int __init mac_sonic_probe(struct platform_device *pdev)
 {
 	struct net_device *dev;
 	struct sonic_local *lp;
@@ -537,8 +537,8 @@ static int __init mac_sonic_probe(struct
 		return -ENOMEM;
 
 	lp = netdev_priv(dev);
-	lp->device = &device->dev;
-	SET_NETDEV_DEV(dev, &device->dev);
+	lp->device = &pdev->dev;
+	SET_NETDEV_DEV(dev, &pdev->dev);
  	SET_MODULE_OWNER(dev);
 
 	/* This will catch fatal stuff like -ENOMEM as well as success */
@@ -579,15 +579,15 @@ MODULE_PARM_DESC(sonic_debug, "macsonic 
 
 #include "sonic.c"
 
-static int __devexit mac_sonic_device_remove (struct platform_device *device)
+static int __devexit mac_sonic_device_remove (struct platform_device *pdev)
 {
-	struct net_device *dev = platform_get_drvdata(device);
+	struct net_device *dev = platform_get_drvdata(pdev);
 	struct sonic_local* lp = netdev_priv(dev);
 
-	unregister_netdev (dev);
+	unregister_netdev(dev);
 	dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
 	                  lp->descriptors, lp->descriptors_laddr);
-	free_netdev (dev);
+	free_netdev(dev);
 
 	return 0;
 }
@@ -610,9 +610,8 @@ static int __init mac_sonic_init_module(
 	}
 
 	mac_sonic_device = platform_device_alloc(mac_sonic_string, 0);
-	if (!mac_sonic_device) {
+	if (!mac_sonic_device)
 		goto out_unregister;
-	}
 
 	if (platform_device_add(mac_sonic_device)) {
 		platform_device_put(mac_sonic_device);
Index: linux-2.6.20/drivers/net/sonic.c
===================================================================
--- linux-2.6.20.orig/drivers/net/sonic.c	2007-03-05 15:19:48.000000000 +1100
+++ linux-2.6.20/drivers/net/sonic.c	2007-03-05 15:20:51.000000000 +1100
@@ -179,8 +179,13 @@ static void sonic_tx_timeout(struct net_
 {
 	struct sonic_local *lp = netdev_priv(dev);
 	int i;
-	/* Stop the interrupts for this */
+	/*
+	 * put the Sonic into software-reset mode and
+	 * disable all interrupts before releasing DMA buffers
+	 */
 	SONIC_WRITE(SONIC_IMR, 0);
+	SONIC_WRITE(SONIC_ISR, 0x7fff);
+	SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
 	/* We could resend the original skbs. Easier to re-initialise. */
 	for (i = 0; i < SONIC_NUM_TDS; i++) {
 		if(lp->tx_laddr[i]) {
-
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