Skip to content

Commit 6bd9a08

Browse files
benzeajmberg-intel
authored andcommitted
wifi: mac80211: set key link ID to the deflink one
When in non-MLO mode, the key ID was set to -1 even for keys that are not pairwise. Change the link ID to be the link ID of the deflink in this case so that drivers do not need to special cases for this. Signed-off-by: Benjamin Berg <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://patch.msgid.link/20250102161730.0c066f084677.I4a5c288465e75119edb6a0df90dddf6f30d14a02@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent e3d91a6 commit 6bd9a08

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

include/net/mac80211.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2229,7 +2229,7 @@ enum ieee80211_key_flags {
22292229
* - Temporal Authenticator Rx MIC Key (64 bits)
22302230
* @icv_len: The ICV length for this key type
22312231
* @iv_len: The IV length for this key type
2232-
* @link_id: the link ID for MLO, or -1 for non-MLO or pairwise keys
2232+
* @link_id: the link ID, 0 for non-MLO, or -1 for pairwise keys
22332233
*/
22342234
struct ieee80211_key_conf {
22352235
atomic64_t tx_pn;

net/mac80211/cfg.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,9 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
503503
if (IS_ERR(link))
504504
return PTR_ERR(link);
505505

506+
if (WARN_ON(pairwise && link_id >= 0))
507+
return -EINVAL;
508+
506509
if (pairwise && params->mode == NL80211_KEY_SET_TX)
507510
return ieee80211_set_tx(sdata, mac_addr, key_idx);
508511

@@ -525,10 +528,12 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
525528
if (IS_ERR(key))
526529
return PTR_ERR(key);
527530

528-
key->conf.link_id = link_id;
529-
530-
if (pairwise)
531+
if (pairwise) {
531532
key->conf.flags |= IEEE80211_KEY_FLAG_PAIRWISE;
533+
key->conf.link_id = -1;
534+
} else {
535+
key->conf.link_id = link->link_id;
536+
}
532537

533538
if (params->mode == NL80211_KEY_NO_TX)
534539
key->conf.flags |= IEEE80211_KEY_FLAG_NO_AUTO_TX;

net/mac80211/key.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ ieee80211_gtk_rekey_add(struct ieee80211_vif *vif,
14091409
if (sdata->u.mgd.mfp != IEEE80211_MFP_DISABLED)
14101410
key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT;
14111411

1412-
key->conf.link_id = link_id;
1412+
key->conf.link_id = link_data->link_id;
14131413

14141414
err = ieee80211_key_link(key, link_data, NULL);
14151415
if (err)

0 commit comments

Comments
 (0)