From patchwork Wed Aug 5 16:18:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 6951671 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7E883C05AD for ; Wed, 5 Aug 2015 16:19:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3D1DA203AE for ; Wed, 5 Aug 2015 16:18:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 498D52039E for ; Wed, 5 Aug 2015 16:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752567AbbHEQSx (ORCPT ); Wed, 5 Aug 2015 12:18:53 -0400 Received: from mail-ob0-f175.google.com ([209.85.214.175]:36615 "EHLO mail-ob0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752498AbbHEQSv (ORCPT ); Wed, 5 Aug 2015 12:18:51 -0400 Received: by obnw1 with SMTP id w1so35261175obn.3 for ; Wed, 05 Aug 2015 09:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=f3+SrOPov9czN3nMROUFmZCKZmMNK+TVxJHQ4gWxE9k=; b=rCN6gw0xwkjVSR0CacESU6Q3k5v2zd54TVV6V583imW0r+LC1NUzftTfb2jAqvGxM2 z3+Wo79VPT3vsjh2Yfr7un+mAK0zvy+gze3WuEPJNbI5UZ+fQHrEr8MeiB4hXgqtPqQF VTqbzxsOUz928Eq0loX2hkqZcMJJdd4VyO0MLABmi7nyEhLnMq47Y9txEMjCdPl8/vBG /HLSsLSeaZeJ4bmfj08AtQobs4cyvEpAtxBUORuE7P+vgwlFz+C/uBh/M7KlPUeJySkr tHUX12tAR0AtyGNG2JVRadr/jI5fYVOt5r+ho4o80QexlxKR/9XP//Mjv1p4GAr0+OBH /+tQ== X-Received: by 10.182.91.4 with SMTP id ca4mr8628188obb.11.1438791531316; Wed, 05 Aug 2015 09:18:51 -0700 (PDT) Received: from linux.site (cpe-24-31-249-175.kc.res.rr.com. [24.31.249.175]) by smtp.gmail.com with ESMTPSA id p133sm1975348oif.3.2015.08.05.09.18.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Aug 2015 09:18:50 -0700 (PDT) From: Larry Finger To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, pkshih , shaofu , Larry Finger Subject: [PATCH V2 NEXT 2/7] rtlwifi: Fix programming of CAM content Date: Wed, 5 Aug 2015 11:18:35 -0500 Message-Id: <1438791520-13216-3-git-send-email-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1438791520-13216-1-git-send-email-Larry.Finger@lwfinger.net> References: <1438791520-13216-1-git-send-email-Larry.Finger@lwfinger.net> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: pkshih There is a potential race condition when the control byte of a CAM entry is written first. Signed-off-by: pkshih Signed-off-by: shaofu Signed-off-by: Larry Finger --- V2 - Removed a udelay() statement introduced because of a merge error --- drivers/net/wireless/rtlwifi/cam.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/cam.c b/drivers/net/wireless/rtlwifi/cam.c index 8fe8b4c..cc7acbf 100644 --- a/drivers/net/wireless/rtlwifi/cam.c +++ b/drivers/net/wireless/rtlwifi/cam.c @@ -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; + s8 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++) { + /* 2-5 fill 128key,6-7 are reserved */ + for (entry_i = CAM_CONTENT_COUNT - 3; entry_i >= 0; entry_i--) { target_command = entry_i + CAM_CONTENT_COUNT * entry_no; target_command = target_command | BIT(31) | BIT(16);