rtlwifi: Assign rx buffer ownership to hardware last
authorMike McCormack <mikem@ring3k.org>
Mon, 30 May 2011 23:49:51 +0000 (08:49 +0900)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 3 Jun 2011 19:01:06 +0000 (15:01 -0400)
Ownership of an rx buffer should only be given to the hardware
after all other changes are written, otherwise there's
a potential race.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rtlwifi/pci.c

index 6c1b9df..e29feef 100644 (file)
@@ -784,8 +784,6 @@ done:
                rtlpriv->cfg->ops->set_desc((u8 *) pdesc, false,
                                            HW_DESC_RXBUFF_ADDR,
                                            (u8 *)&bufferaddress);
-               rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false, HW_DESC_RXOWN,
-                                           (u8 *)&tmp_one);
                rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false,
                                            HW_DESC_RXPKT_LEN,
                                            (u8 *)&rtlpci->rxbuffersize);
@@ -795,6 +793,9 @@ done:
                                                    HW_DESC_RXERO,
                                                    (u8 *)&tmp_one);
 
+               rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false, HW_DESC_RXOWN,
+                                           (u8 *)&tmp_one);
+
                index = (index + 1) % rtlpci->rxringcount;
        }