summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/wil6210/debugfs.c
diff options
context:
space:
mode:
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>2014-07-14 09:49:40 +0300
committerJohn W. Linville <linville@tuxdriver.com>2014-07-18 13:45:23 -0400
commit359ee6275368c6fc8c6143f706e1b0075a244070 (patch)
tree88cb9353522f26b4edc725532e43ccecdda779cb /drivers/net/wireless/ath/wil6210/debugfs.c
parent76dfa4b7715679b8f90499745c071d44472c200c (diff)
downloadlinux-359ee6275368c6fc8c6143f706e1b0075a244070.tar.gz
linux-359ee6275368c6fc8c6143f706e1b0075a244070.tar.bz2
linux-359ee6275368c6fc8c6143f706e1b0075a244070.zip
wil6210: fix memory leak on error path in wil_write_file_rxon()
If copy_from_user() fails, buffer allocated for parameters would leak Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/wil6210/debugfs.c')
-rw-r--r--drivers/net/wireless/ath/wil6210/debugfs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index 7435b5a256ab..b6400680850a 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -448,8 +448,10 @@ static ssize_t wil_write_file_rxon(struct file *file, const char __user *buf,
char *kbuf = kmalloc(len + 1, GFP_KERNEL);
if (!kbuf)
return -ENOMEM;
- if (copy_from_user(kbuf, buf, len))
+ if (copy_from_user(kbuf, buf, len)) {
+ kfree(kbuf);
return -EIO;
+ }
kbuf[len] = '\0';
rc = kstrtol(kbuf, 0, &channel);