From patchwork Fri Jan 9 13:57:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasanthakumar Thiagarajan X-Patchwork-Id: 5600271 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 324B99F357 for ; Fri, 9 Jan 2015 14:01:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A7BD205DB for ; Fri, 9 Jan 2015 14:01:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7FC80205DA for ; Fri, 9 Jan 2015 14:01:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754930AbbAIOBb (ORCPT ); Fri, 9 Jan 2015 09:01:31 -0500 Received: from sabertooth01.qualcomm.com ([65.197.215.72]:43095 "EHLO sabertooth01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756541AbbAIOBb (ORCPT ); Fri, 9 Jan 2015 09:01:31 -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=1420812091; x=1452348091; h=from:to:cc:subject:date:message-id:mime-version; bh=j6zepvRwPBMqSd6Kkfqe50Cphtm3vURMTcFIYewu+Kc=; b=q9nmWFTVtaFCm764HI/AYxcP9C6KOlRJoKWdaiTE1FRDlfSAZnXPi1ho WiCNpnN6L3jIJbg93/rJ45QNvWpIQSJ1gFh7pYAue/BpD2i5oWhc/rCKZ 4k/FLxasyLJtqnF+J3aUqsa9WUhyB1sv60kRCWK5f6pP0VeXjYEL46zUu 4=; X-IronPort-AV: E=McAfee;i="5600,1067,7675"; a="81250999" Received: from ironmsg01-lv.qualcomm.com ([10.47.202.180]) by sabertooth01.qualcomm.com with ESMTP; 09 Jan 2015 06:01:14 -0800 X-IronPort-AV: E=Sophos;i="5.07,730,1413270000"; d="scan'208";a="32099207" Received: from nasanexhc09.na.qualcomm.com ([172.30.39.8]) by ironmsg01-lv.qualcomm.com with ESMTP/TLS/RC4-SHA; 09 Jan 2015 06:01:14 -0800 Received: from aphydexm01f.ap.qualcomm.com (10.222.112.211) by nasanexhc09.na.qualcomm.com (172.30.39.8) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 9 Jan 2015 06:01:13 -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 06:00:57 -0800 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Fri, 09 Jan 2015 19:27:29 +0530 From: Vasanthakumar Thiagarajan To: CC: , Vasanthakumar Thiagarajan Subject: [PATCH] ath10k: Fix potential Rx ring corruption Date: Fri, 9 Jan 2015 19:27:26 +0530 Message-ID: <1420811846-20660-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: nasanexm01a.na.qualcomm.com (10.85.0.81) 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; }