diff mbox series

mac80211: fix potential deadlock in ieee80211_key_link()

Message ID 20220827022452.823381-1-sunke32@huawei.com (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show
Series mac80211: fix potential deadlock in ieee80211_key_link() | expand

Commit Message

Sun Ke Aug. 27, 2022, 2:24 a.m. UTC
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>
---
 net/mac80211/key.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Kalle Valo Sept. 1, 2022, 4:41 a.m. UTC | #1
Sun Ke <sunke32@huawei.com> writes:

> 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>

The title is missing "wifi:".
Sun Ke Sept. 1, 2022, 6:37 a.m. UTC | #2
在 2022/9/1 12:41, Kalle Valo 写道:
> Sun Ke <sunke32@huawei.com> writes:
> 
>> 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>
> 
> The title is missing "wifi:".

Johannes had modified it by hand.

Thanks,
Sun Ke
>
diff mbox series

Patch

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]);