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>
This commit is contained in:
parent
76dfa4b771
commit
359ee62753
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue