]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
rtlwifi: Fix programing CAM content sequence.
authorPing-Ke Shih <pkshih@realtek.com>
Tue, 7 Feb 2017 03:29:58 +0000 (21:29 -0600)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 7 Feb 2017 07:25:08 +0000 (09:25 +0200)
There is a potential race condition when the control byte of a CAM
entry is written first. Write in reverse order to correct the condition.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: shaofu <shaofu@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/cam.c

index a0605d8e99703d53168f06ee13f31accda56cda4..f7a7dcbf945ef67e5a1f2b991906c1c598de0eab 100644 (file)
@@ -45,12 +45,13 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
 
        u32 target_command;
        u32 target_content = 0;
-       u8 entry_i;
+       int entry_i;
 
        RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_DMESG, "Key content :",
                      key_cont_128, 16);
 
-       for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
+       /* 0-1 config + mac, 2-5 fill 128key,6-7 are reserved */
+       for (entry_i = CAM_CONTENT_COUNT - 1; entry_i >= 0; entry_i--) {
                target_command = entry_i + CAM_CONTENT_COUNT * entry_no;
                target_command = target_command | BIT(31) | BIT(16);
 
@@ -102,7 +103,6 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
                                        target_content);
                        rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
                                        target_command);
-                       udelay(100);
 
                        RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
                                 "WRITE A4: %x\n", target_content);