linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: "Pali Rohár" <pali@kernel.org>, "Sasha Levin" <sashal@kernel.org>
Cc: Luca Coelho <luca@coelho.fi>,
	linux-wireless@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 11/12] mac80211: drop data frames without key on encrypted links
Date: Wed, 23 Jun 2021 14:16:12 +0200	[thread overview]
Message-ID: <804462f2381df5fb30fba7e186e62375352b8adc.camel@sipsolutions.net> (raw)
In-Reply-To: <20210611101046.zej2t2oc6hsc67yv@pali>

On Fri, 2021-06-11 at 12:10 +0200, Pali Rohár wrote:
> 
> @@ -341,8 +341,11 @@ static void ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
>  	if (sta) {
>  		if (pairwise) {
>  			rcu_assign_pointer(sta->ptk[idx], new);
> -			sta->ptk_idx = idx;
> -			ieee80211_check_fast_xmit(sta);
> +			if (new) {
> +				set_sta_flag(new->sta, WLAN_STA_USES_ENCRYPTION);
> +				new->sta->ptk_idx = new->conf.keyidx;

I'm not entirely sure moving that assignment under the guard is correct.

> +				ieee80211_check_fast_xmit(new->sta);

and I'm pretty sure that moving call under the guard is incorrect,
although in the end it probably doesn't even matter if we will drop all
frames anyway (due to this patch).

So all you need under the assignment is the flag, but also only
theoretically, because the function cannot be called with old==NULL &&
new==NULL, the first time around it's called we must have old==NULL (no
key was ever installed), and so the first time it's called it must be
old==NULL && new!=NULL, and then the flag gets set and we never want to
clear it again, so I believe you don't need the "if (new)" condition at
all.

In the code as it was in (and before) my patch the condition is
necessary because we use 'new' to obtain the 'sta' and 'local' pointers,
but otherwise we don't really need it even in the current version.

johannes




  parent reply	other threads:[~2021-06-23 12:16 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26 13:09 [PATCH v2 00/12] cfg80211/mac80211 patches from our internal tree 2020-03-26-2 Luca Coelho
2020-03-26 13:09 ` [PATCH v2 01/12] mac80211: implement Operating Mode Notification extended NSS support Luca Coelho
2020-03-26 13:09 ` [PATCH v2 02/12] mac80211: add twt_protected flag to the bss_conf structure Luca Coelho
2020-03-26 13:09 ` [PATCH v2 03/12] mac80211: Don't destroy auth data in case of anti-clogging Luca Coelho
2020-03-26 13:09 ` [PATCH v2 04/12] cfg80211: Parse HE membership selector Luca Coelho
2020-03-26 13:09 ` [PATCH v2 05/12] mac80211: Skip entries with " Luca Coelho
2020-03-26 13:09 ` [PATCH v2 06/12] mac80211: agg-tx: refactor sending addba Luca Coelho
2020-03-26 13:09 ` [PATCH v2 07/12] mac80211: agg-tx: add an option to defer ADDBA transmit Luca Coelho
2020-03-26 13:09 ` [PATCH v2 08/12] mac80211: Fail association when AP has no legacy rates Luca Coelho
2020-03-26 13:09 ` [PATCH v2 09/12] mac80211: minstrel_ht_assign_best_tp_rates: remove redundant test Luca Coelho
2020-03-26 13:09 ` [PATCH v2 10/12] mac80211_hwsim: indicate in IBSS that we have transmitted beacons Luca Coelho
2020-03-26 13:09 ` [PATCH v2 11/12] mac80211: drop data frames without key on encrypted links Luca Coelho
2020-03-27 15:03   ` Sasha Levin
2021-06-11 10:10     ` Pali Rohár
2021-06-22 23:15       ` Pali Rohár
2021-06-23 14:55         ` Greg KH
2021-06-23 12:16       ` Johannes Berg [this message]
2021-06-29 21:32         ` Pali Rohár
2021-06-30  6:49           ` Johannes Berg
2021-08-16 13:44     ` [PATCH] " Pali Rohár
2021-08-16 13:54       ` Greg KH
2020-03-26 13:09 ` [PATCH v2 12/12] cfg80211: Do not warn on same channel at the end of CSA Luca Coelho

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=804462f2381df5fb30fba7e186e62375352b8adc.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luca@coelho.fi \
    --cc=pali@kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).