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>
This commit is contained in:

committed by
John W. Linville

parent
cbe1bc2383
commit
8e09b7d2db
@@ -573,8 +573,10 @@ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf,
|
|||||||
if (!frame)
|
if (!frame)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
if (copy_from_user(frame, buf, len))
|
if (copy_from_user(frame, buf, len)) {
|
||||||
|
kfree(frame);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
params.buf = frame;
|
params.buf = frame;
|
||||||
params.len = len;
|
params.len = len;
|
||||||
@@ -614,8 +616,10 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
rc = simple_write_to_buffer(wmi, len, ppos, buf, len);
|
rc = simple_write_to_buffer(wmi, len, ppos, buf, len);
|
||||||
if (rc < 0)
|
if (rc < 0) {
|
||||||
|
kfree(wmi);
|
||||||
return rc;
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
cmd = &wmi[1];
|
cmd = &wmi[1];
|
||||||
cmdid = le16_to_cpu(wmi->id);
|
cmdid = le16_to_cpu(wmi->id);
|
||||||
|
Reference in New Issue
Block a user