mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
Staging: comedi: Return -EFAULT if copy_to_user() fails
Return -EFAULT on error instead of the number of bytes remaining to be
copied.
Fixes: bac42fb212
("comedi: get rid of compat_alloc_user_space() mess in COMEDI_CMD{,TEST} compat")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/X8c3pfwFy2jpy4BP@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
12b38ea040
commit
cab36da4bf
1 changed files with 3 additions and 1 deletions
|
@ -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. */
|
||||
|
|
Loading…
Reference in a new issue