]> git.karo-electronics.de Git - linux-beck.git/commitdiff
wil6210: fix memory leak on error path in wil_write_file_rxon()
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Mon, 14 Jul 2014 06:49:40 +0000 (09:49 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 18 Jul 2014 17:45:23 +0000 (13:45 -0400)
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>
drivers/net/wireless/ath/wil6210/debugfs.c

index 7435b5a256abab26b505522232f8b6d443dcff31..b6400680850aebd7331dd2ac7212e5e1aed32bcb 100644 (file)
@@ -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);