mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 16:37:50 +00:00
wifi: wil6210: debugfs: fix info leak in wil_write_file_wmi()
[ Upstream commit7a4836560a
] The simple_write_to_buffer() function will succeed if even a single byte is initialized. However, we need to initialize the whole buffer to prevent information leaks. Just use memdup_user(). Fixes:ff974e4083
("wil6210: debugfs interface to send raw WMI command") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com> Link: https://lore.kernel.org/r/Ysg14NdKAZF/hcNG@kili Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
48cca38787
commit
c1216e699a
1 changed files with 4 additions and 10 deletions
|
@ -836,18 +836,12 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,
|
||||||
u16 cmdid;
|
u16 cmdid;
|
||||||
int rc, rc1;
|
int rc, rc1;
|
||||||
|
|
||||||
if (cmdlen < 0)
|
if (cmdlen < 0 || *ppos != 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
wmi = kmalloc(len, GFP_KERNEL);
|
wmi = memdup_user(buf, len);
|
||||||
if (!wmi)
|
if (IS_ERR(wmi))
|
||||||
return -ENOMEM;
|
return PTR_ERR(wmi);
|
||||||
|
|
||||||
rc = simple_write_to_buffer(wmi, len, ppos, buf, len);
|
|
||||||
if (rc < 0) {
|
|
||||||
kfree(wmi);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd = (cmdlen > 0) ? &wmi[1] : NULL;
|
cmd = (cmdlen > 0) ? &wmi[1] : NULL;
|
||||||
cmdid = le16_to_cpu(wmi->command_id);
|
cmdid = le16_to_cpu(wmi->command_id);
|
||||||
|
|
Loading…
Reference in a new issue