diff -ru vmnet-only.orig/bridge.c vmnet-only/bridge.c --- vmnet-only.orig/bridge.c Thu May 10 11:33:58 2001 +++ vmnet-only/bridge.c Thu Aug 16 17:33:07 2001 @@ -19,7 +19,7 @@ #include #include #include -#include +#include #ifdef KERNEL_2_1 #include #include @@ -44,7 +44,7 @@ #include "vnetInt.h" -#define VNET_BRIDGE_HISTORY 8 +#define VNET_BRIDGE_HISTORY 48 typedef struct VNetBridge VNetBridge; @@ -58,6 +58,7 @@ Bool savedPromisc; struct sk_buff *history[VNET_BRIDGE_HISTORY]; VNetPort port; + spinlock_t historyLock; }; @@ -130,6 +131,7 @@ goto out; } memset(bridge, 0, sizeof *bridge); + spin_lock_init(&bridge->historyLock); memcpy(bridge->name, devName, sizeof bridge->name); /* @@ -391,6 +393,8 @@ unsigned long flags; int i; SKB_INCREF(clone); + + spin_lock_irqsave(&bridge->historyLock, flags); // XXX need to lock history for (i = 0; i < VNET_BRIDGE_HISTORY; i++) { if (bridge->history[i] == NULL) { @@ -417,11 +421,15 @@ for (i = 0; i < VNET_BRIDGE_HISTORY; i++) { struct sk_buff *s = bridge->history[i]; bridge->history[i] = NULL; - KFREE_SKB(s, FREE_WRITE); + if (s) { + spin_unlock_irqrestore(&bridge->historyLock, flags); + KFREE_SKB(s, FREE_WRITE); + spin_lock_irqsave(&bridge->historyLock, flags); + } } bridge->history[0] = clone; } - + spin_unlock_irqrestore(&bridge->historyLock, flags); clone->dev = dev; clone->protocol = eth_type_trans(clone, dev); save_flags(flags); @@ -773,6 +781,7 @@ { VNetBridge *bridge = *(VNetBridge**)&((struct sock *)pt->data)->protinfo; int i; + unsigned long flags; if (bridge->dev == NULL) { LOG(3, (KERN_DEBUG "bridge-%s: received %d closed\n", @@ -782,11 +791,13 @@ } // XXX need to lock history + spin_lock_irqsave(&bridge->historyLock, flags); for (i = 0; i < VNET_BRIDGE_HISTORY; i++) { struct sk_buff *s = bridge->history[i]; if (s != NULL && (s == skb || SKB_IS_CLONE_OF(skb, s))) { bridge->history[i] = NULL; + spin_unlock_irqrestore(&bridge->historyLock, flags); KFREE_SKB(s, FREE_WRITE); LOG(3, (KERN_DEBUG "bridge-%s: receive %d self %d\n", bridge->name, (int) skb->len, i)); @@ -795,6 +806,7 @@ return 0; } } + spin_unlock_irqrestore(&bridge->historyLock, flags); # if LOGLEVEL >= 4 { diff -ru vmnet-only.orig/driver.c vmnet-only/driver.c --- vmnet-only.orig/driver.c Thu May 10 11:33:58 2001 +++ vmnet-only/driver.c Thu Aug 16 17:33:13 2001 @@ -20,7 +20,7 @@ #include #include #include -#include +#include #ifdef KERNEL_2_1 #include #include diff -ru vmnet-only.orig/hub.c vmnet-only/hub.c --- vmnet-only.orig/hub.c Thu May 10 11:33:58 2001 +++ vmnet-only/hub.c Thu Aug 16 17:33:57 2001 @@ -19,7 +19,7 @@ #include #include #include -#include +#include #ifdef KERNEL_2_1 #include #include diff -ru vmnet-only.orig/netif.c vmnet-only/netif.c --- vmnet-only.orig/netif.c Thu May 10 11:33:58 2001 +++ vmnet-only/netif.c Thu Aug 16 17:33:21 2001 @@ -19,7 +19,7 @@ #include #include #include -#include +#include #ifdef KERNEL_2_1 #include #include diff -ru vmnet-only.orig/procfs.c vmnet-only/procfs.c --- vmnet-only.orig/procfs.c Thu May 10 11:33:58 2001 +++ vmnet-only/procfs.c Thu Aug 16 17:33:27 2001 @@ -19,7 +19,7 @@ #include #include #include -#include +#include #ifdef KERNEL_2_1 #include #include diff -ru vmnet-only.orig/userif.c vmnet-only/userif.c --- vmnet-only.orig/userif.c Thu May 10 11:33:58 2001 +++ vmnet-only/userif.c Thu Aug 16 17:33:33 2001 @@ -19,7 +19,7 @@ #include #include #include -#include +#include #ifdef KERNEL_2_1 #include #include