[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH] Avoid ASSERTion failure caused by sample ordering reversal



In __ReceiverPushPackets() the value of Receiver->Indicated is sampled
prior to the value of Receiver->Returned. This allows packets to be
indicated and returned on other CPUs between the two sample points
leading to an ASSERTion failure because the value of Returned will be
greater than that of Indicated.

The solution is simply to reverse the sample ordering.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xennet/receiver.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/xennet/receiver.c b/src/xennet/receiver.c
index ccc00ec..e5635d2 100644
--- a/src/xennet/receiver.c
+++ b/src/xennet/receiver.c
@@ -377,11 +377,13 @@ __ReceiverPushPackets(
 
     KeReleaseSpinLockFromDpcLevel(&Queue->Lock);
 
-    Indicated = InterlockedAdd(&Receiver->Indicated, Count);
+    (VOID) InterlockedAdd(&Receiver->Indicated, Count);
+
+    Returned = Receiver->Returned;
 
     KeMemoryBarrier();
 
-    Returned = Receiver->Returned;
+    Indicated = Receiver->Indicated;
 
     Flags = NDIS_RECEIVE_FLAGS_DISPATCH_LEVEL |
             NDIS_RECEIVE_FLAGS_PERFECT_FILTERED;
-- 
2.5.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.