From: Johannes Berg <johannes.berg@intel.com>
Date: Fri, 25 Oct 2013 09:15:12 +0000 (+0200)
Subject: nl80211: fix error path in nl80211_get_key()
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9fe271af7d4de96471c5aaee2f4d0d1576050497;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

nl80211: fix error path in nl80211_get_key()

Coverity pointed out that in the (practically impossible)
error case we leak the message - fix this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 0ffb18371376..f1370ed9f498 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2687,7 +2687,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
 	hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
 			     NL80211_CMD_NEW_KEY);
 	if (!hdr)
-		return -ENOBUFS;
+		goto nla_put_failure;
 
 	cookie.msg = msg;
 	cookie.idx = key_idx;