Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: lustre: obdclass: return -EFAULT if copy_from_user() fails

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 <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dan Carpenter and committed by
Greg Kroah-Hartman
092c3def 3ca121c2

+2 -1
+2 -1
drivers/staging/lustre/lustre/obdclass/class_obd.c
··· 180 180 err = -ENOMEM; 181 181 goto out; 182 182 } 183 - err = copy_from_user(lcfg, data->ioc_pbuf1, data->ioc_plen1); 183 + if (copy_from_user(lcfg, data->ioc_pbuf1, data->ioc_plen1)) 184 + err = -EFAULT; 184 185 if (!err) 185 186 err = lustre_cfg_sanity_check(lcfg, data->ioc_plen1); 186 187 if (!err)