jme: Prevent possible read re-order error
authorGuo-Fu Tseng <cooldavid@cooldavid.org>
Mon, 18 Oct 2010 11:56:20 +0000 (19:56 +0800)
committerGuo-Fu Tseng <cooldavid@cooldavid.org>
Mon, 18 Oct 2010 23:51:46 +0000 (07:51 +0800)
Adding read memory barrier in between flag reading and data reading of
receive descriptors. This prevents the data being read before hardware
complete writing informations.

Reported-by: Stefan Hajnoczi <stefanha@gmail.com>
jme.c

diff --git a/jme.c b/jme.c
index e3db53f..db82f17 100644 (file)
--- a/jme.c
+++ b/jme.c
@@ -999,6 +999,7 @@ jme_process_receive(struct jme_adapter *jme, int limit)
                        goto out;
                --limit;
 
+               rmb();
                desccnt = rxdesc->descwb.desccnt & RXWBDCNT_DCNT;
 
                if (unlikely(desccnt > 1 ||