diff options
author | Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> | 2014-07-14 02:49:40 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-07-18 13:45:23 -0400 |
commit | 359ee6275368c6fc8c6143f706e1b0075a244070 (patch) | |
tree | 88cb9353522f26b4edc725532e43ccecdda779cb /drivers/net/wireless/ath/wil6210/debugfs.c | |
parent | 76dfa4b7715679b8f90499745c071d44472c200c (diff) |
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.c | 4 |
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, | |||
448 | char *kbuf = kmalloc(len + 1, GFP_KERNEL); | 448 | char *kbuf = kmalloc(len + 1, GFP_KERNEL); |
449 | if (!kbuf) | 449 | if (!kbuf) |
450 | return -ENOMEM; | 450 | return -ENOMEM; |
451 | if (copy_from_user(kbuf, buf, len)) | 451 | if (copy_from_user(kbuf, buf, len)) { |
452 | kfree(kbuf); | ||
452 | return -EIO; | 453 | return -EIO; |
454 | } | ||
453 | 455 | ||
454 | kbuf[len] = '\0'; | 456 | kbuf[len] = '\0'; |
455 | rc = kstrtol(kbuf, 0, &channel); | 457 | rc = kstrtol(kbuf, 0, &channel); |