diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 5cec0c251e86..065a9205a858 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -566,6 +566,8 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, /* KRACK protection, shouldn't happen but just silently accept key */ if (err == -EALREADY) err = 0; + if (err == -EINVAL) + ieee80211_key_free_unused(key); return err; }