aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2012-09-02 09:41:04 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-09-04 12:06:00 -0400
commitb4e4f47e940bc93c5b1125a4429ff53956754800 (patch)
treeb7cfe228d939d69b217c4b632abf57184e7a894f /net
parent3d2abdfdf14f4d6decc2023708211e19b096f4ca (diff)
nl80211: fix possible memory leak nl80211_connect()
connkeys is malloced in nl80211_parse_connkeys() and should be freed in the error handling case, otherwise it will cause memory leak. spatch with a semantic match is used to found this problem. (http://coccinelle.lip6.fr/) Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/wireless/nl80211.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 97026f3b215a..1e37dbf00cb3 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5633,8 +5633,10 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
5633 sizeof(connect.ht_capa_mask)); 5633 sizeof(connect.ht_capa_mask));
5634 5634
5635 if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) { 5635 if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) {
5636 if (!info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) 5636 if (!info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) {
5637 kfree(connkeys);
5637 return -EINVAL; 5638 return -EINVAL;
5639 }
5638 memcpy(&connect.ht_capa, 5640 memcpy(&connect.ht_capa,
5639 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]), 5641 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]),
5640 sizeof(connect.ht_capa)); 5642 sizeof(connect.ht_capa));