From: Kalle Valo <kvalo@codeaurora.org>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: ath9k-devel@qca.qualcomm.com, davem@davemloft.net,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ath9k: Fix possible data races in ath_set_channel()
Date: Mon, 13 Jan 2020 09:17:28 +0200 [thread overview]
Message-ID: <87a76rsu47.fsf@codeaurora.org> (raw)
In-Reply-To: <20200111171528.7053-1-baijiaju1990@gmail.com> (Jia-Ju Bai's message of "Sun, 12 Jan 2020 01:15:28 +0800")
Jia-Ju Bai <baijiaju1990@gmail.com> writes:
> The functions ath9k_config() and ath_ani_calibrate() may be concurrently
> executed.
>
> A variable survey->filled is accessed with holding a spinlock
> common->cc_lock, through:
> ath_ani_calibrate()
> spin_lock_irqsave(&common->cc_lock, flags);
> ath_update_survey_stats()
> ath_update_survey_nf()
> survey->filled |= SURVEY_INFO_NOISE_DBM;
>
> The identical variables sc->cur_survey->filled and
> sc->survey[pos].filled is accessed without holding this lock, through:
> ath9k_config()
> ath_chanctx_set_channel()
> ath_set_channel()
> sc->cur_survey->filled &= ~SURVEY_INFO_IN_USE;
> sc->cur_survey->filled |= SURVEY_INFO_IN_USE;
> else if (!(sc->survey[pos].filled & SURVEY_INFO_IN_USE))
> ath_update_survey_nf
> survey->filled |= SURVEY_INFO_NOISE_DBM;
>
> Thus, possible data races may occur.
>
> To fix these data races, in ath_set_channel(), these variables are
> accessed with holding the spinlock common->cc_lock.
>
> These data races are found by the runtime testing of our tool DILP-2.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
I need a detailed review from somone familiar with ath9k before I can
consider applying this.
--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2020-01-13 7:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-11 17:15 [PATCH] ath9k: Fix possible data races in ath_set_channel() Jia-Ju Bai
2020-01-13 7:17 ` Kalle Valo [this message]
2020-01-13 8:27 ` Felix Fietkau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a76rsu47.fsf@codeaurora.org \
--to=kvalo@codeaurora.org \
--cc=ath9k-devel@qca.qualcomm.com \
--cc=baijiaju1990@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.