[PATCH wireless] wifi: mac80211: Fix a memory leak in ieee80211_key_link()

From: Christophe JAILLET
Date: Sun Oct 01 2023 - 02:09:15 EST


Commit 5d6020ba6657 seems to be conflicting with d097ae01ebd4 and what
used to "goto out" now ends with a direct return.

Restore the expected behavior.

Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
---
This patch is here more to draw attention to something that looks wrong
because of a merge conflict.

If there is really an issue, then the commit description certainly need to
we improved, by someone that know the recent changes better than me.
---
net/mac80211/key.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 2913c6b13558..af74d7f9d94d 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -910,8 +910,10 @@ int ieee80211_key_link(struct ieee80211_key *key,
* Silently accept key re-installation without really installing the
* new version of the key to avoid nonce reuse or replay issues.
*/
- if (ieee80211_key_identical(sdata, old_key, key))
- return -EALREADY;
+ if (ieee80211_key_identical(sdata, old_key, key)) {
+ ret = -EALREADY;
+ goto out;
+ }

key->local = sdata->local;
key->sdata = sdata;
--
2.34.1