Commit 359ee627 authored by Vladimir Kondratiev's avatar Vladimir Kondratiev Committed by John W. Linville

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: default avatarVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 76dfa4b7
...@@ -448,8 +448,10 @@ static ssize_t wil_write_file_rxon(struct file *file, const char __user *buf, ...@@ -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); char *kbuf = kmalloc(len + 1, GFP_KERNEL);
if (!kbuf) if (!kbuf)
return -ENOMEM; return -ENOMEM;
if (copy_from_user(kbuf, buf, len)) if (copy_from_user(kbuf, buf, len)) {
kfree(kbuf);
return -EIO; return -EIO;
}
kbuf[len] = '\0'; kbuf[len] = '\0';
rc = kstrtol(kbuf, 0, &channel); rc = kstrtol(kbuf, 0, &channel);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment