aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorSun Ke <sunke32@huawei.com>2022-08-27 10:24:52 +0800
committerJohannes Berg <johannes.berg@intel.com>2022-08-29 11:48:59 +0200
commit7c13844c3b7662976270996552eee3a0849afc3f (patch)
treed8922afd70b013aefb9942d2f479a7f8c9e61fb6 /net/mac80211
parentMerge tag 'wireless-next-2022-08-26-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next (diff)
downloadlinux-dev-7c13844c3b7662976270996552eee3a0849afc3f.tar.xz
linux-dev-7c13844c3b7662976270996552eee3a0849afc3f.zip
wifi: mac80211: fix potential deadlock in ieee80211_key_link()
Add the missing unlock before return in the error handling case. Fixes: ccdde7c74ffd ("wifi: mac80211: properly implement MLO key handling") Signed-off-by: Sun Ke <sunke32@huawei.com> Link: https://lore.kernel.org/r/20220827022452.823381-1-sunke32@huawei.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/key.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 86aac87e0211..d89ec93b243b 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -865,8 +865,10 @@ int ieee80211_key_link(struct ieee80211_key *key,
if (link_id >= 0) {
link_sta = rcu_dereference_protected(sta->link[link_id],
lockdep_is_held(&sta->local->sta_mtx));
- if (!link_sta)
- return -ENOLINK;
+ if (!link_sta) {
+ ret = -ENOLINK;
+ goto out;
+ }
}
old_key = key_mtx_dereference(sdata->local, link_sta->gtk[idx]);