Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 21d62e81 authored by Wang Qing's avatar Wang Qing Committed by Greg Kroah-Hartman
Browse files

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: e01bcdd6 ("vfio: ccw: realize VFIO_DEVICE_GET_REGION_INFO ioctl")
Signed-off-by: default avatarWang Qing <wangqing@vivo.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Link: https://lore.kernel.org/r/1614600093-13992-1-git-send-email-wangqing@vivo.com


Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6b687917
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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:
	{