Commit b58d6021 authored by Devendra Naga's avatar Devendra Naga Committed by Greg Kroah-Hartman

staging: sep: return -EFAULT on copy_from_user failure

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: default avatarDevendra Naga <devendra.aaru@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 28c4ff64
...@@ -3431,7 +3431,7 @@ static ssize_t sep_create_dcb_dmatables_context(struct sep_device *sep, ...@@ -3431,7 +3431,7 @@ static ssize_t sep_create_dcb_dmatables_context(struct sep_device *sep,
if (copy_from_user(dcb_args, if (copy_from_user(dcb_args,
user_dcb_args, user_dcb_args,
num_dcbs * sizeof(struct build_dcb_struct))) { num_dcbs * sizeof(struct build_dcb_struct))) {
error = -EINVAL; error = -EFAULT;
goto end_function; goto end_function;
} }
...@@ -3619,7 +3619,7 @@ static ssize_t sep_create_msgarea_context(struct sep_device *sep, ...@@ -3619,7 +3619,7 @@ static ssize_t sep_create_msgarea_context(struct sep_device *sep,
/* Copy input data to write() to allocated message buffer */ /* Copy input data to write() to allocated message buffer */
if (copy_from_user(*msg_region, msg_user, msg_len)) { if (copy_from_user(*msg_region, msg_user, msg_len)) {
error = -EINVAL; error = -EFAULT;
goto end_function; goto end_function;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment