aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLino Sanfilippo <LinoSanfilippo@gmx.de>2014-11-27 20:47:19 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-12-01 15:57:20 -0500
commit8e09b7d2dbb86eb3e9a714d6622f4da24e988029 (patch)
tree1fddbc3a3ce89755a45a047bc7d06299fcb755ef
parentcbe1bc2383ad69a35e4b030c00642785b8b135e8 (diff)
wil6210: Fix potential memory leaks on error paths
Fix missing memory deallocation on error paths in wil_write_file_wmi() and wil_write_file_txmgmt(). Reported-by: Ahmed Tamrawi <ahmedtamrawi@gmail.com> Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de> Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/wil6210/debugfs.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index 54a6ddc6301b..4e6e14501c2f 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -573,8 +573,10 @@ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf,
573 if (!frame) 573 if (!frame)
574 return -ENOMEM; 574 return -ENOMEM;
575 575
576 if (copy_from_user(frame, buf, len)) 576 if (copy_from_user(frame, buf, len)) {
577 kfree(frame);
577 return -EIO; 578 return -EIO;
579 }
578 580
579 params.buf = frame; 581 params.buf = frame;
580 params.len = len; 582 params.len = len;
@@ -614,8 +616,10 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,
614 return -ENOMEM; 616 return -ENOMEM;
615 617
616 rc = simple_write_to_buffer(wmi, len, ppos, buf, len); 618 rc = simple_write_to_buffer(wmi, len, ppos, buf, len);
617 if (rc < 0) 619 if (rc < 0) {
620 kfree(wmi);
618 return rc; 621 return rc;
622 }
619 623
620 cmd = &wmi[1]; 624 cmd = &wmi[1];
621 cmdid = le16_to_cpu(wmi->id); 625 cmdid = le16_to_cpu(wmi->id);