提交 b0035964 编写于 作者: O Olaf Hering 提交者: Greg Kroah-Hartman

Drivers: hv: utils: use memdup_user in hvt_op_write

Use memdup_user to handle OOM.

Fixes: 14b50f80 ('Drivers: hv: util: introduce hv_utils_transport abstraction')
Signed-off-by: NOlaf Hering <olaf@aepfle.de>
Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 cdc0c0c9
...@@ -80,11 +80,10 @@ static ssize_t hvt_op_write(struct file *file, const char __user *buf, ...@@ -80,11 +80,10 @@ static ssize_t hvt_op_write(struct file *file, const char __user *buf,
hvt = container_of(file->f_op, struct hvutil_transport, fops); hvt = container_of(file->f_op, struct hvutil_transport, fops);
inmsg = kzalloc(count, GFP_KERNEL); inmsg = memdup_user(buf, count);
if (copy_from_user(inmsg, buf, count)) { if (IS_ERR(inmsg))
kfree(inmsg); return PTR_ERR(inmsg);
return -EFAULT;
}
if (hvt->on_msg(inmsg, count)) if (hvt->on_msg(inmsg, count))
return -EFAULT; return -EFAULT;
kfree(inmsg); kfree(inmsg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册