提交 cab36da4 编写于 作者: D Dan Carpenter 提交者: Greg Kroah-Hartman

Staging: comedi: Return -EFAULT if copy_to_user() fails

Return -EFAULT on error instead of the number of bytes remaining to be
copied.

Fixes: bac42fb2 ("comedi: get rid of compat_alloc_user_space() mess in COMEDI_CMD{,TEST} compat")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/X8c3pfwFy2jpy4BP@mwandaSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 12b38ea0
......@@ -2987,7 +2987,9 @@ static int put_compat_cmd(struct comedi32_cmd_struct __user *cmd32,
v32.chanlist_len = cmd->chanlist_len;
v32.data = ptr_to_compat(cmd->data);
v32.data_len = cmd->data_len;
return copy_to_user(cmd32, &v32, sizeof(v32));
if (copy_to_user(cmd32, &v32, sizeof(v32)))
return -EFAULT;
return 0;
}
/* Handle 32-bit COMEDI_CMD ioctl. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册