mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
mwifiex: Fix mem leak in mwifiex_tm_cmd
'hostcmd' is alloced by kzalloc, should be freed before
leaving from the error handling cases, otherwise it will
cause mem leak.
Fixes: 3935ccc14d
("mwifiex: add cfg80211 testmode support")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
e5b9b206f3
commit
003b686ace
1 changed files with 5 additions and 1 deletions
|
@ -4082,16 +4082,20 @@ static int mwifiex_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev,
|
|||
|
||||
if (mwifiex_send_cmd(priv, 0, 0, 0, hostcmd, true)) {
|
||||
dev_err(priv->adapter->dev, "Failed to process hostcmd\n");
|
||||
kfree(hostcmd);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
/* process hostcmd response*/
|
||||
skb = cfg80211_testmode_alloc_reply_skb(wiphy, hostcmd->len);
|
||||
if (!skb)
|
||||
if (!skb) {
|
||||
kfree(hostcmd);
|
||||
return -ENOMEM;
|
||||
}
|
||||
err = nla_put(skb, MWIFIEX_TM_ATTR_DATA,
|
||||
hostcmd->len, hostcmd->cmd);
|
||||
if (err) {
|
||||
kfree(hostcmd);
|
||||
kfree_skb(skb);
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue