summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/vdpa/vdpa_user/vduse_dev.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index 26e3d90d1e7c..cefb301b2ee4 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -966,6 +966,10 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd,
break;
}
case VDUSE_DEV_INJECT_CONFIG_IRQ:
+ ret = -EINVAL;
+ if (!(dev->status & VIRTIO_CONFIG_S_DRIVER_OK))
+ break;
+
ret = 0;
queue_work(vduse_irq_wq, &dev->inject);
break;
@@ -1045,6 +1049,10 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd,
case VDUSE_VQ_INJECT_IRQ: {
u32 index;
+ ret = -EINVAL;
+ if (!(dev->status & VIRTIO_CONFIG_S_DRIVER_OK))
+ break;
+
ret = -EFAULT;
if (get_user(index, (u32 __user *)argp))
break;