s390/cio: return -EFAULT if copy_to_user() fails
authorEric Farman <farman@linux.ibm.com>
Mon, 1 Mar 2021 18:33:24 +0000 (19:33 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 8 Mar 2021 09:46:30 +0000 (10:46 +0100)
Fixes: 120e214e504f ("vfio: ccw: realize VFIO_DEVICE_G(S)ET_IRQ_INFO ioctls")
Signed-off-by: Eric Farman <farman@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
drivers/s390/cio/vfio_ccw_ops.c

index 557d0b8..767ac41 100644 (file)
@@ -582,7 +582,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev,
                if (info.count == -1)
                        return -EINVAL;
 
-               return copy_to_user((void __user *)arg, &info, minsz);
+               return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0;
        }
        case VFIO_DEVICE_SET_IRQS:
        {