Received: by 10.192.165.148 with SMTP id m20csp4013912imm; Tue, 8 May 2018 01:09:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrSn7Msw7QULHH+A2LTh9lTRcjPA9hw73Ky8rDwafS6OIOsNjfQArqxarJso1X8vByy+viP X-Received: by 2002:a17:902:9303:: with SMTP id bc3-v6mr40245378plb.18.1525766954982; Tue, 08 May 2018 01:09:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525766954; cv=none; d=google.com; s=arc-20160816; b=j59h3MD9ye757eP23NM9lXT4779uoPQUG4K1dxMFr4ufxj1mrMdRe6HoRu6YViLB9M 5gPfDGush+DqSvYBWTT+JrjUInYnm/Ct/FA8xB4kwFt7OJp+w1qldjT4KOGH8IiIlUO0 G6fZloW9e+BVKh5jdWu7crgdhTtys8mu7+4s9ks9Dbu8QrTsPerj0H7+H6xGmbmqJgCM 9VmUa1XyRHO0nU3RjmJ6Ee0U3JUR07X0dJRuwAQt5xR4B2x1RyD0nLFYq64fSEji7L07 BL5xlKqBFX5txZhcmH2hQWBwVqOPXClbmxU2rDxhG0MtKwpfAWz6W85A5IZX1ycmy8v/ HD/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=79rNItQrjZHJ5auhVICd4WULjkHISOO/T+xJGwJhL+g=; b=AAEbTfYuBY2Jwo1NPyqKy3kv3kJCMdIt8unlgs0nWw26nfnGPKxRf91D+Z0mjRnR3c IyybnD7Sti4kjvlMYbmrH0CtC7ld1GS+Ycn1I4VyXsZ2YUBRmyf9LiYtgGPWcop/TnHe szQNs7sfuyDeliDzVQQhhucBIpZVLfj0QT488VpcXW8/SwgdLkT0/U82PhnPQ+vPWuKZ 0wAu+kqXN8ZCy8gTLnVijawgCfVcEnH6qKWwh4iMxhq0MYDUmQAqT1Kww86AOYBv7Ftl bVINNK6J42OWc1EMZmFdL9lARjfME9/NqkE6w2ryf03zUXpvd5hFuVRgE4T++LnInU91 qvsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gKvu04t2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b34-v6si22931336plc.53.2018.05.08.01.09.00; Tue, 08 May 2018 01:09:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gKvu04t2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754444AbeEHIGt (ORCPT + 99 others); Tue, 8 May 2018 04:06:49 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:35182 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754296AbeEHIGo (ORCPT ); Tue, 8 May 2018 04:06:44 -0400 Received: by mail-pg0-f68.google.com with SMTP id j11-v6so20833383pgf.2; Tue, 08 May 2018 01:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=79rNItQrjZHJ5auhVICd4WULjkHISOO/T+xJGwJhL+g=; b=gKvu04t2FuFpDUIxLk9E4kl0k36+zd098jB2TJsekN/0W0fJYrq6NhZFQoOK8RD3Fy YI4yGAYrg9+itxxJuQj9uoPy8L9D14uElirU7DK02gWYVQ1eHALVs5O8D9V4Yl/XZK5/ WiA91T8mKBC7mOVapCIkN7VyXVJrNUPef7UkxN5RcATIGZO41qaU6gB5We5cNqZpSdGY vGp7ytsN6MQtl48w+eqf70szW5tGWNJg+v4ZcC1XZWU5rBWwGmGfgjTPXtsHmpDkM2vy aoTOtoZCR+FL2dQ61LpjD8HR2TBtsqTZ5rSUF+1OKqOIOqscdBMAjedKFmDLaK7XTqxb smAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=79rNItQrjZHJ5auhVICd4WULjkHISOO/T+xJGwJhL+g=; b=poDpBmZUr5t7GCeaGcQvugzeKrtIvW3tOmB6sRUTPMa38NiDaCDfsCuHI66nIV9iNr SGGtMoF8PpiGlgKlvCaj+hz5YSqvXjsTNJO4jhQtZlTAd2YJH+Yk0TgsmryaX/YJPXF8 D0w70eihRNa4Qh7n9c86g7K97JFl0s57+vNwUxzwRvmAlu0B2cPibh41XqjDQcUaPrW7 D/XLEwriDbi8+vpUyy+er5kIJgxlAhKtwU4DN0sALhidMSQ7y4VJp25rTOcdKK0+X9ZJ Uck3aVTgx8iC4VbrnFYzDHUpc+zfhczVBAEJrYi/xay8E4n9ANHoUvRS52Fee2YLgNzK Hn2A== X-Gm-Message-State: ALQs6tAR+dGrIQe1kefMvmmu09ORxfoj/V3vk+nlmfUHerD7eFGi2KR+ aa+7SMnvfrbD2kdJCkrKiJwO8A== X-Received: by 10.98.198.21 with SMTP id m21mr34570549pfg.232.1525766804222; Tue, 08 May 2018 01:06:44 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:9049:25cd:b90:73a0]) by smtp.gmail.com with ESMTPSA id n83sm53965284pfi.183.2018.05.08.01.06.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 01:06:43 -0700 (PDT) From: Jia-Ju Bai To: ath9k-devel@qca.qualcomm.com, kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] net: wireless: ath: ath9k: Fix a possible data race in ath_chanctx_set_next Date: Tue, 8 May 2018 16:06:36 +0800 Message-Id: <20180508080636.13827-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The write operation to "sc->next_chan" is protected by the lock on line 1287, but the read operation to this data on line 1262 is not protected by the lock. Thus, there may exist a data race for "sc->next_chan". To fix this data race, the read operation to "sc->next_chan" should be also protected by the lock. Signed-off-by: Jia-Ju Bai --- drivers/net/wireless/ath/ath9k/channel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c index 1b05b5d7a038..ed3cd5523481 100644 --- a/drivers/net/wireless/ath/ath9k/channel.c +++ b/drivers/net/wireless/ath/ath9k/channel.c @@ -1257,12 +1257,12 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool force) "Stopping current chanctx: %d\n", sc->cur_chan->chandef.center_freq1); sc->cur_chan->stopped = true; - spin_unlock_bh(&sc->chan_lock); if (sc->next_chan == &sc->offchannel.chan) { getrawmonotonic(&ts); measure_time = true; } + spin_unlock_bh(&sc->chan_lock); ath9k_chanctx_stop_queues(sc, sc->cur_chan); queues_stopped = true; -- 2.17.0