From: Sun Ke Date: Sat, 27 Aug 2022 02:24:52 +0000 (+0800) Subject: wifi: mac80211: fix potential deadlock in ieee80211_key_link() X-Git-Tag: v6.6.17~6504^2~266^2~68 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c13844c3b7662976270996552eee3a0849afc3f;p=platform%2Fkernel%2Flinux-rpi.git 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 Link: https://lore.kernel.org/r/20220827022452.823381-1-sunke32@huawei.com Signed-off-by: Johannes Berg --- diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 86aac87..d89ec93 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]);