diff options
author | Devendra Naga <devendra.aaru@gmail.com> | 2012-10-27 13:23:47 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-29 14:59:39 -0700 |
commit | b58d6021d4dbc215dc975510bb2509e66e6061be (patch) | |
tree | 6541ed2e66a5b5ddb100f215741a3578ab40aef8 | |
parent | 28c4ff643549f18a6c50df694ce4ba9975b7917f (diff) | |
download | lwn-b58d6021d4dbc215dc975510bb2509e66e6061be.tar.gz lwn-b58d6021d4dbc215dc975510bb2509e66e6061be.zip |
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: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/sep/sep_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c index a414e52dd082..2c8df0e6b6d0 100644 --- a/drivers/staging/sep/sep_main.c +++ b/drivers/staging/sep/sep_main.c @@ -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; } @@ -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; } |