Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);