Skip to content

Commit ed6a473

Browse files
committed
wifi: mac80211: fix key tailroom accounting leak
For keys added by ieee80211_gtk_rekey_add(), we assume that they're already present in the hardware and set the flag KEY_FLAG_UPLOADED_TO_HARDWARE. However, setting this flag needs to be paired with decrementing the tailroom needed, which was missed. Fixes: f52a0b4 ("wifi: mac80211: mark keys as uploaded when added by the driver") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20251019115358.c88eafb4083e.I69e9d4d78a756a133668c55b5570cf15a4b0e6a4@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 3776c68 commit ed6a473

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

net/mac80211/key.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,16 @@ static int ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
508508
ret = ieee80211_key_enable_hw_accel(new);
509509
}
510510
} else {
511-
if (!new->local->wowlan)
511+
if (!new->local->wowlan) {
512512
ret = ieee80211_key_enable_hw_accel(new);
513-
else if (link_id < 0 || !sdata->vif.active_links ||
514-
BIT(link_id) & sdata->vif.active_links)
513+
} else if (link_id < 0 || !sdata->vif.active_links ||
514+
BIT(link_id) & sdata->vif.active_links) {
515515
new->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE;
516+
if (!(new->conf.flags & (IEEE80211_KEY_FLAG_GENERATE_MMIC |
517+
IEEE80211_KEY_FLAG_PUT_MIC_SPACE |
518+
IEEE80211_KEY_FLAG_RESERVE_TAILROOM)))
519+
decrease_tailroom_need_count(sdata, 1);
520+
}
516521
}
517522

518523
if (ret)

0 commit comments

Comments
 (0)