From patchwork Thu Jun 22 01:24:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaoqing Pan X-Patchwork-Id: 9803215 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2D72D60234 for ; Thu, 22 Jun 2017 01:25:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18183283A5 for ; Thu, 22 Jun 2017 01:25:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B03328554; Thu, 22 Jun 2017 01:25:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B60D6283A5 for ; Thu, 22 Jun 2017 01:25:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752056AbdFVBZI (ORCPT ); Wed, 21 Jun 2017 21:25:08 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:44050 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751148AbdFVBZH (ORCPT ); Wed, 21 Jun 2017 21:25:07 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D9DAB606B7; Thu, 22 Jun 2017 01:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1498094706; bh=7fwTcO2z0T4K6UiuNAB+4zo0eGUoJq99xYnMQqsg0dY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RF+8mPo0YqmXIcjdYHu+aE9kxKw8R74OriUy2qUeENvkaCUkdj0jfe9+psBgMoJCu Anxtx1SneLEFsGHnD8DycZ/YWwZNXVwqj+3/HpVH+MLLgwDjGr63ZDslOa17oIHKz7 IMamF2+O2naovWvkhER9uGta7SIf6HLkwvslh4sw= Received: from smtp.codeaurora.org (unknown [180.166.53.21]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: miaoqing@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2475E60850; Thu, 22 Jun 2017 01:25:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1498094706; bh=7fwTcO2z0T4K6UiuNAB+4zo0eGUoJq99xYnMQqsg0dY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RF+8mPo0YqmXIcjdYHu+aE9kxKw8R74OriUy2qUeENvkaCUkdj0jfe9+psBgMoJCu Anxtx1SneLEFsGHnD8DycZ/YWwZNXVwqj+3/HpVH+MLLgwDjGr63ZDslOa17oIHKz7 IMamF2+O2naovWvkhER9uGta7SIf6HLkwvslh4sw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2475E60850 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=miaoqing@codeaurora.org Received: by smtp.codeaurora.org (sSMTP sendmail emulation); Thu, 22 Jun 2017 09:24:43 +0800 From: miaoqing@codeaurora.org To: kvalo@qca.qualcomm.com Cc: linux-wireless@vger.kernel.org, ath9k-devel@qca.qualcomm.com, sssa@qti.qualcomm.com, giulio.genovese@gmail.com, Miaoqing Pan Subject: [PATCH 3/3] ath9k: Use mutex_lock to avoid potential race in start/stop rng Date: Thu, 22 Jun 2017 09:24:29 +0800 Message-Id: <1498094669-6510-3-git-send-email-miaoqing@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1498094669-6510-1-git-send-email-miaoqing@codeaurora.org> References: <1498094669-6510-1-git-send-email-miaoqing@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Miaoqing Pan Move ath9k_rng_stop/ath9k_rng_start pair into critical section, use mutex_lock to void potential race accessing. Signed-off-by: Miaoqing Pan --- drivers/net/wireless/ath/ath9k/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 9e65d14..8b4ac7f 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c @@ -731,12 +731,12 @@ static int ath9k_start(struct ieee80211_hw *hw) spin_unlock_bh(&sc->sc_pcu_lock); + ath9k_rng_start(sc); + mutex_unlock(&sc->mutex); ath9k_ps_restore(sc); - ath9k_rng_start(sc); - return 0; } @@ -826,10 +826,10 @@ static void ath9k_stop(struct ieee80211_hw *hw) ath9k_deinit_channel_context(sc); - ath9k_rng_stop(sc); - mutex_lock(&sc->mutex); + ath9k_rng_stop(sc); + ath_cancel_work(sc); if (test_bit(ATH_OP_INVALID, &common->op_flags)) {