nl80211: fix error path in nl80211_get_key()
authorJohannes Berg <johannes.berg@intel.com>
Fri, 25 Oct 2013 09:15:12 +0000 (11:15 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 25 Nov 2013 15:50:06 +0000 (16:50 +0100)
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>
net/wireless/nl80211.c

index 0ffb183..f1370ed 100644 (file)
@@ -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;