wifi: mac80211: fix another key installation error path
authorJohannes Berg <johannes.berg@intel.com>
Fri, 20 Oct 2023 07:38:28 +0000 (09:38 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 23 Oct 2023 10:29:54 +0000 (12:29 +0200)
Due to overlapping changes and merges, another error
path ended up broken. Fix this one as well.

Reported-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/key.c

index e0ff3a753e15d1dc3d39d69f29739a70c78f4036..af74d7f9d94d0404298b14b2fed608b57a70546d 100644 (file)
@@ -881,8 +881,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->hw.wiphy->mtx));
-                       if (!link_sta)
-                               return -ENOLINK;
+                       if (!link_sta) {
+                               ret = -ENOLINK;
+                               goto out;
+                       }
                }
 
                old_key = wiphy_dereference(sdata->local->hw.wiphy,