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:	Mon, 5 Oct 2009 07:58:42 -0400 (EDT)
From:	Sreenivasa Honnur <Sreenivasa.Honnur@...erion.com>
To:	davem@...emloft.net
cc:	netdev@...r.kernel.org, support@...erion.com
Subject: [net-next-2.6 PATCH 8/9] vxge: Acquire correct lock based on interrupt
 context.

- Added macros that check if the thread is in interrupt context or not to
  acquire or release locks

Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@...erion.com>
---
diff -urpN patch7/drivers/net/vxge/vxge-main.c patch8/drivers/net/vxge/vxge-main.c
--- patch7/drivers/net/vxge/vxge-main.c	2009-09-04 02:13:34.000000000 -0700
+++ patch8/drivers/net/vxge/vxge-main.c	2009-09-04 02:18:15.000000000 -0700
@@ -97,10 +97,10 @@ static inline void VXGE_COMPLETE_VPATH_T
 		more = 0;
 		skb_ptr = completed;
 
-		if (spin_trylock_irqsave(&fifo->tx_lock, flags)) {
+		if (vxge_spin_trylock(&fifo->tx_lock, flags)) {
 			vxge_hw_vpath_poll_tx(fifo->handle, &skb_ptr,
 						NR_SKB_COMPLETED, &more);
-			spin_unlock_irqrestore(&fifo->tx_lock, flags);
+			vxge_spin_unlock(&fifo->tx_lock, flags);
 		}
 		/* free SKBs */
 		for (temp = completed; temp != skb_ptr; temp++)
diff -urpN patch7/drivers/net/vxge/vxge-main.h patch8/drivers/net/vxge/vxge-main.h
--- patch7/drivers/net/vxge/vxge-main.h	2009-09-04 02:05:36.000000000 -0700
+++ patch8/drivers/net/vxge/vxge-main.h	2009-09-04 02:16:40.000000000 -0700
@@ -89,6 +89,26 @@
 
 #define VXGE_LL_MAX_FRAME_SIZE(dev) ((dev)->mtu + VXGE_HW_MAC_HEADER_MAX_SIZE)
 
+#define vxge_spin_lock(l, f) {                  \
+	if (in_interrupt())                     \
+		spin_lock(l);                   \
+	else                                    \
+		spin_lock_irqsave(l, f);        \
+}
+
+#define vxge_spin_trylock(l, f) \
+({ \
+	in_interrupt() ? \
+	spin_trylock(l) : spin_trylock_irqsave(l, f); \
+})
+
+#define vxge_spin_unlock(l, f) {                \
+	if (in_interrupt())                     \
+		spin_unlock(l);                 \
+	else                                    \
+		spin_unlock_irqrestore(l, f);   \
+}
+
 enum vxge_reset_event {
 	/* reset events */
 	VXGE_LL_VPATH_RESET	= 0,

--
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