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

Commit dd5abd3e authored by Lino Sanfilippo's avatar Lino Sanfilippo Committed by Hamad Kadmany
Browse files

wil6210: Fix potential memory leaks on error paths



Fix missing memory deallocation on error paths in wil_write_file_wmi()
and wil_write_file_txmgmt().

Change-Id: I5b86ff2dee9deb0ce357a76e0e70d1ef6470a8fe
Reported-by: default avatarAhmed Tamrawi <ahmedtamrawi@gmail.com>
Signed-off-by: default avatarLino Sanfilippo <LinoSanfilippo@gmx.de>
Signed-off-by: default avatarVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Git-commit: 8e09b7d2dbb86eb3e9a714d6622f4da24e988029
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git


Signed-off-by: default avatarHamad Kadmany <hkadmany@codeaurora.org>
parent ac6fe126
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -572,8 +572,10 @@ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf,
	if (!frame)
		return -ENOMEM;

	if (copy_from_user(frame, buf, len))
	if (copy_from_user(frame, buf, len)) {
		kfree(frame);
		return -EIO;
	}

	rc = wil_cfg80211_mgmt_tx(wiphy, wdev, wdev->preset_chandef.chan,
				true, 0, frame, len, true, false, NULL);
@@ -610,8 +612,10 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,
		return -ENOMEM;

	rc = simple_write_to_buffer(wmi, len, ppos, buf, len);
	if (rc < 0)
	if (rc < 0) {
		kfree(wmi);
		return rc;
	}

	cmd = &wmi[1];
	cmdid = le16_to_cpu(wmi->id);