From patchwork Fri Jan 9 17:19:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasanthakumar Thiagarajan X-Patchwork-Id: 5602001 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 0C563C058E for ; Fri, 9 Jan 2015 17:23:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 36F32205DB for ; Fri, 9 Jan 2015 17:23:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A2E820606 for ; Fri, 9 Jan 2015 17:23:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758121AbbAIRXg (ORCPT ); Fri, 9 Jan 2015 12:23:36 -0500 Received: from wolverine01.qualcomm.com ([199.106.114.254]:32544 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758119AbbAIRXe (ORCPT ); Fri, 9 Jan 2015 12:23:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1420824214; x=1452360214; h=from:to:cc:subject:date:message-id:mime-version; bh=j6zepvRwPBMqSd6Kkfqe50Cphtm3vURMTcFIYewu+Kc=; b=bWGOZXLYLCp2kpqdrM11jCJRClpguXkpGldQD6BZWXbyTkXQFpxuSuH3 YSKugtfAOcblvaMCiOmX/A9BitVK/S9F4/Ojd2GfY9f9XxW/2skenkZau sXeiv1L0nGO57/sJdRjHpQL2VTU7iCqwU8sIiZYYEHjRAndV0DqlnmBVu M=; X-IronPort-AV: E=McAfee;i="5600,1067,7675"; a="97407534" Received: from ironmsg01-lv.qualcomm.com ([10.47.202.180]) by wolverine01.qualcomm.com with ESMTP; 09 Jan 2015 09:23:33 -0800 X-IronPort-AV: E=Sophos;i="5.07,731,1413270000"; d="scan'208";a="32100338" Received: from nasanexhc07.na.qualcomm.com ([172.30.39.190]) by ironmsg01-lv.qualcomm.com with ESMTP/TLS/RC4-SHA; 09 Jan 2015 09:23:33 -0800 Received: from aphydexm01f.ap.qualcomm.com (10.222.112.211) by nasanexhc07.na.qualcomm.com (172.30.39.190) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 9 Jan 2015 09:23:32 -0800 Received: from qcmail1.qualcomm.com (10.80.80.8) by aphydexm01f.ap.qualcomm.com (10.222.112.211) with Microsoft SMTP Server (TLS) id 15.0.995.29; Fri, 9 Jan 2015 09:23:26 -0800 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Fri, 09 Jan 2015 22:49:49 +0530 From: Vasanthakumar Thiagarajan To: CC: , Vasanthakumar Thiagarajan Subject: [PATCH RESEND] ath10k: Fix potential Rx ring corruption Date: Fri, 9 Jan 2015 22:49:46 +0530 Message-ID: <1420823986-29503-1-git-send-email-vthiagar@qti.qualcomm.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01D.na.qualcomm.com (10.85.0.84) To aphydexm01f.ap.qualcomm.com (10.222.112.211) 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable 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 When replenishing Rx buffers driver updates the address of the buffer and the index of rx buffer in rx ring to the firmware. Change in order by CPU can cause rx ring corruption. Add memory barrier before updating rx buffer index to guarantee the order. This could fix some instances of rx ring corruption due to done bit in rx attention flag not set. Signed-off-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath/ath10k/htt_rx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 9c782a4..baa1c44 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -97,6 +97,11 @@ static int __ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num) } fail: + /* + * Make sure the rx buffer is updated before available buffer + * index to avoid any potential rx ring corruption. + */ + mb(); *htt->rx_ring.alloc_idx.vaddr = __cpu_to_le32(idx); return ret; }