2009-07-15 08:02:17

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH] nl80211: Memory leak fixed

From: Niko Jokinen <[email protected]>

Potential memory leak via msg pointer in nl80211_get_key() function.

Signed-off-by: Niko Jokinen <[email protected]>
Signed-off-by: Luciano Coelho <[email protected]>
---
net/wireless/nl80211.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 6dad3e7..9beaed8 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1215,7 +1215,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)

if (IS_ERR(hdr)) {
err = PTR_ERR(hdr);
- goto out;
+ goto free_msg;
}

cookie.msg = msg;
@@ -1230,7 +1230,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
&cookie, get_key_callback);

if (err)
- goto out;
+ goto free_msg;

if (cookie.error)
goto nla_put_failure;
@@ -1241,6 +1241,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)

nla_put_failure:
err = -ENOBUFS;
+ free_msg:
nlmsg_free(msg);
out:
cfg80211_unlock_rdev(rdev);
--
1.5.6.5