Skip to content

Commit

Permalink
staging: sep: return -EFAULT on copy_from_user failure
Browse files Browse the repository at this point in the history
copy_from_user() returns the number of bytes remaining to be copied,
and it fails if user pointer is invalid, so return -EFAULT
so that the user gets a FAULT.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Devendra Naga authored and Greg Kroah-Hartman committed Oct 29, 2012
1 parent 28c4ff6 commit b58d602
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/sep/sep_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3431,7 +3431,7 @@ static ssize_t sep_create_dcb_dmatables_context(struct sep_device *sep,
if (copy_from_user(dcb_args,
user_dcb_args,
num_dcbs * sizeof(struct build_dcb_struct))) {
error = -EINVAL;
error = -EFAULT;
goto end_function;
}

Expand Down Expand Up @@ -3619,7 +3619,7 @@ static ssize_t sep_create_msgarea_context(struct sep_device *sep,

/* Copy input data to write() to allocated message buffer */
if (copy_from_user(*msg_region, msg_user, msg_len)) {
error = -EINVAL;
error = -EFAULT;
goto end_function;
}

Expand Down

0 comments on commit b58d602

Please sign in to comment.