wifi: mac80211: fix error path key leak
authorJohannes Berg <johannes.berg@intel.com>
Thu, 5 Oct 2023 21:09:18 +0000 (23:09 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 11 Oct 2023 14:36:14 +0000 (16:36 +0200)
In the previous key leak fix for the other error
paths, I meant to unify all of them to the same
place, but used the wrong label, which I noticed
when doing the merge into wireless-next. Fix it.

Fixes: d097ae01ebd4 ("wifi: mac80211: fix potential key leak")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/key.c

index 0665ff5..a2db058 100644 (file)
@@ -912,7 +912,7 @@ int ieee80211_key_link(struct ieee80211_key *key,
         */
        if (ieee80211_key_identical(sdata, old_key, key)) {
                ret = -EALREADY;
-               goto unlock;
+               goto out;
        }
 
        key->local = sdata->local;
@@ -940,7 +940,6 @@ int ieee80211_key_link(struct ieee80211_key *key,
 
  out:
        ieee80211_key_free_unused(key);
- unlock:
        mutex_unlock(&sdata->local->key_mtx);
 
        return ret;