[lkml]   [2017]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 3.16 055/133] staging: lustre: obdclass: return -EFAULT if copy_from_user() fails
3.16.51-rc1 review patch.  If anyone has any objections, please let me know.


From: Dan Carpenter <>

commit 092c3def24bb68a00ff58c76ed67b9ff448387ce upstream.

The copy_from_user() function returns the number of bytes which we
weren't able to copy. We don't want to return that to the user but
instead we want to return -EFAULT.

Fixes: d7e09d0397e8 ("staging: add Lustre file system client support")
Signed-off-by: Dan Carpenter <>
Signed-off-by: Greg Kroah-Hartman <>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <>
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -232,8 +232,8 @@ int class_handle_ioctl(unsigned int cmd,
OBD_ALLOC(lcfg, data->ioc_plen1);
if (lcfg == NULL)
GOTO(out, err = -ENOMEM);
- err = copy_from_user(lcfg, data->ioc_pbuf1,
- data->ioc_plen1);
+ if (copy_from_user(lcfg, data->ioc_pbuf1, data->ioc_plen1))
+ err = -EFAULT;
if (!err)
err = lustre_cfg_sanity_check(lcfg, data->ioc_plen1);
if (!err)
 \ /
  Last update: 2017-11-22 03:26    [W:1.640 / U:0.648 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site