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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1314139240-869-9-git-send-email-mark.einon@gmail.com>
Date:	Tue, 23 Aug 2011 23:40:40 +0100
From:	Mark Einon <mark.einon@...il.com>
To:	gregkh@...e.de
Cc:	greg@...ah.com, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org, o.hartmann@...ovital.com,
	Mark Einon <mark.einon@...il.com>
Subject: [PATCH 8/8] staging: et131x: Update tx trans_start on device close to prevent tx_timeout

Updating the tx trans_start before closing the device prevents a possible tx_timeout occuring during the closing process.
Tested on an ET1310 device.

Signed-off-by: Mark Einon <mark.einon@...il.com>
---
 drivers/staging/et131x/et131x_netdev.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 70a0da3..7555a24 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -153,7 +153,7 @@ int et131x_open(struct net_device *netdev)
 	result = request_irq(netdev->irq, et131x_isr, IRQF_SHARED,
 					netdev->name, netdev);
 	if (result) {
-		dev_err(&adapter->pdev->dev, "c ould not register IRQ %d\n",
+		dev_err(&adapter->pdev->dev, "could not register IRQ %d\n",
 			netdev->irq);
 		return result;
 	}
@@ -182,6 +182,9 @@ int et131x_close(struct net_device *netdev)
 {
 	struct et131x_adapter *adapter = netdev_priv(netdev);
 
+	/* Save the timestamp for the TX watchdog, prevent a timeout */
+	netdev->trans_start = jiffies;
+
 	/* First thing is to stop the queue */
 	netif_stop_queue(netdev);
 
@@ -449,6 +452,10 @@ void et131x_tx_timeout(struct net_device *netdev)
 	struct tcb *tcb;
 	unsigned long flags;
 
+	/* If the device is closed, ignore the timeout */
+	if (~(adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE));
+		return;
+
 	/* Any nonrecoverable hardware error?
 	 * Checks adapter->flags for any failure in phy reading
 	 */
@@ -685,12 +692,12 @@ struct net_device *et131x_device_alloc(void)
 		return NULL;
 	}
 
-	/* Setup the function registration table (and other data) for a
+	/*
+	 * Setup the function registration table (and other data) for a
 	 * net_device
 	 */
-
 	netdev->watchdog_timeo = ET131X_TX_TIMEOUT;
-	netdev->netdev_ops = &et131x_netdev_ops;
+	netdev->netdev_ops     = &et131x_netdev_ops;
 
 	/* netdev->ethtool_ops        = &et131x_ethtool_ops; */
 
-- 
1.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ