Re: linux-next: manual merge of the wireless-next tree with the wireless tree

From: Stephen Rothwell
Date: Mon Sep 25 2023 - 22:41:26 EST


Hi all,

On Tue, 26 Sep 2023 12:02:53 +1000 Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
>
> Today's linux-next merge of the wireless-next tree got conflicts in:
>
> net/mac80211/cfg.c
>
> between commit:
>
> 31db78a4923e ("wifi: mac80211: fix potential key use-after-free")
>
> from the wireless tree and commit:
>
> 4d3acf4311a0 ("wifi: mac80211: remove sta_mtx")
>
> from the wireless-next tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging. You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.

That wasn't quite right. The final resolution is below.
--
Cheers,
Stephen Rothwell

diff --cc net/mac80211/cfg.c
index 0e3a1753a51c,5bc6b1329465..3e7bb883137c
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@@ -472,8 -470,9 +470,10 @@@ static int ieee80211_add_key(struct wip
struct ieee80211_local *local = sdata->local;
struct sta_info *sta = NULL;
struct ieee80211_key *key;
+ int err;

+ lockdep_assert_wiphy(local->hw.wiphy);
+
if (!ieee80211_sdata_running(sdata))
return -ENETDOWN;

@@@ -565,15 -561,7 +562,11 @@@
break;
}

- return ieee80211_key_link(key, link, sta);
+ err = ieee80211_key_link(key, link, sta);
+ /* KRACK protection, shouldn't happen but just silently accept key */
+ if (err == -EALREADY)
+ err = 0;
-
- out_unlock:
- mutex_unlock(&local->sta_mtx);
-
+ return err;
}

static struct ieee80211_key *

Attachment: pgp6RNIW2LkY1.pgp
Description: OpenPGP digital signature