summaryrefslogtreecommitdiff
path: root/drivers/s390
diff options
context:
space:
mode:
authorWang Qing <wangqing@vivo.com>2021-03-01 15:01:33 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-17 18:34:29 +0300
commit87515f38983d913cf196f0fadf2bef7f9dd4f84e (patch)
tree873e14606002f17ef587ad4f0158720677989ba7 /drivers/s390
parentf5e60f4b4eebc34382664e8c8287bd81b5a27b5b (diff)
downloadlinux-87515f38983d913cf196f0fadf2bef7f9dd4f84e.tar.xz
s390/cio: return -EFAULT if copy_to_user() fails again
commit 51c44babdc19aaf882e1213325a0ba291573308f upstream. The copy_to_user() function returns the number of bytes remaining to be copied, but we want to return -EFAULT if the copy doesn't complete. Fixes: e01bcdd61320 ("vfio: ccw: realize VFIO_DEVICE_GET_REGION_INFO ioctl") Signed-off-by: Wang Qing <wangqing@vivo.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Link: https://lore.kernel.org/r/1614600093-13992-1-git-send-email-wangqing@vivo.com Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/cio/vfio_ccw_ops.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c
index 560013c8d2a4..3222a6a45096 100644
--- a/drivers/s390/cio/vfio_ccw_ops.c
+++ b/drivers/s390/cio/vfio_ccw_ops.c
@@ -341,7 +341,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev,
if (ret)
return ret;
- return copy_to_user((void __user *)arg, &info, minsz);
+ return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0;
}
case VFIO_DEVICE_GET_REGION_INFO:
{
@@ -362,7 +362,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev,
if (ret)
return ret;
- return copy_to_user((void __user *)arg, &info, minsz);
+ return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0;
}
case VFIO_DEVICE_GET_IRQ_INFO:
{