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>
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index 7435b5a..b640068 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -448,8 +448,10 @@
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);