All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Karlson <jekarl@iki.fi>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: linux-wireless@vger.kernel.org, "Felix Fietkau" <nbd@nbd.name>,
	"Daniel Golle" <daniel@makrotopia.org>,
	"Tomislav Požega" <pozega.tomislav@gmail.com>,
	"Mathias Kresin" <dev@kresin.me>,
	"Fredrik Noring" <noring@nocrew.org>
Subject: Re: [PATCH 5.3] rt2x00: clear up IV's on key removal
Date: Tue, 27 Aug 2019 11:30:32 +0300	[thread overview]
Message-ID: <20190827113032.42e69b72@lettuce> (raw)
In-Reply-To: <1566564483-31088-1-git-send-email-sgruszka@redhat.com>

On Fri, 23 Aug 2019 14:48:03 +0200
Stanislaw Gruszka <sgruszka@redhat.com> wrote:

> After looking at code I realized that my previous fix
> 95844124385e ("rt2x00: clear IV's on start to fix AP mode regression")
> was incomplete. We can still have wrong IV's after re-keyring.
> To fix that, clear up IV's also on key removal.
> 
> Fixes: 710e6cc1595e ("rt2800: do not nullify initialization vector
> data") Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
>  drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 19
> ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index
> ecbe78b8027b..28e2de04834e 100644 ---
> a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++
> b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -1654,13 +1654,18
> @@ static void rt2800_config_wcid_attr_cipher(struct rt2x00_dev
> *rt2x00dev, offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
>  
> -	rt2800_register_multiread(rt2x00dev, offset,
> -				  &iveiv_entry, sizeof(iveiv_entry));
> -	if ((crypto->cipher == CIPHER_TKIP) ||
> -	    (crypto->cipher == CIPHER_TKIP_NO_MIC) ||
> -	    (crypto->cipher == CIPHER_AES))
> -		iveiv_entry.iv[3] |= 0x20;
> -	iveiv_entry.iv[3] |= key->keyidx << 6;
> +	if (crypto->cmd == SET_KEY) {
> +		rt2800_register_multiread(rt2x00dev, offset,
> +					  &iveiv_entry,
> sizeof(iveiv_entry));
> +		if ((crypto->cipher == CIPHER_TKIP) ||
> +		    (crypto->cipher == CIPHER_TKIP_NO_MIC) ||
> +		    (crypto->cipher == CIPHER_AES))
> +			iveiv_entry.iv[3] |= 0x20;
> +		iveiv_entry.iv[3] |= key->keyidx << 6;
> +	} else {
> +		memset(&iveiv_entry, 0, sizeof(iveiv_entry));
> +	}
> +
>  	rt2800_register_multiwrite(rt2x00dev, offset,
>  				   &iveiv_entry,
> sizeof(iveiv_entry)); }

Seems to work when used with the previous patch on top of 5.3-rc6
tested-by: Emil Karlson <jekarl@iki.fi>

  reply	other threads:[~2019-08-27  8:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23 12:48 [PATCH 5.3] rt2x00: clear up IV's on key removal Stanislaw Gruszka
2019-08-27  8:30 ` Emil Karlson [this message]
2019-09-03 13:52 ` Kalle Valo

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=20190827113032.42e69b72@lettuce \
    --to=jekarl@iki.fi \
    --cc=daniel@makrotopia.org \
    --cc=dev@kresin.me \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=noring@nocrew.org \
    --cc=pozega.tomislav@gmail.com \
    --cc=sgruszka@redhat.com \
    /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.