|
|
@@ -1035,8 +1035,10 @@ ssize_t vhost_chr_write_iter(struct vhost_dev *dev,
|
|
|
int type, ret;
|
|
|
|
|
|
ret = copy_from_iter(&type, sizeof(type), from);
|
|
|
- if (ret != sizeof(type))
|
|
|
+ if (ret != sizeof(type)) {
|
|
|
+ ret = -EINVAL;
|
|
|
goto done;
|
|
|
+ }
|
|
|
|
|
|
switch (type) {
|
|
|
case VHOST_IOTLB_MSG:
|
|
|
@@ -1055,8 +1057,10 @@ ssize_t vhost_chr_write_iter(struct vhost_dev *dev,
|
|
|
|
|
|
iov_iter_advance(from, offset);
|
|
|
ret = copy_from_iter(&msg, sizeof(msg), from);
|
|
|
- if (ret != sizeof(msg))
|
|
|
+ if (ret != sizeof(msg)) {
|
|
|
+ ret = -EINVAL;
|
|
|
goto done;
|
|
|
+ }
|
|
|
if (vhost_process_iotlb_msg(dev, &msg)) {
|
|
|
ret = -EFAULT;
|
|
|
goto done;
|