Skip to content

Commit 7f05630

Browse files
YongjiXiemstsirkin
authored andcommitted
vhost-vdpa: Handle the failure of vdpa_reset()
The vdpa_reset() may fail now. This adds check to its return value and fail the vhost_vdpa_open(). Signed-off-by: Xie Yongji <[email protected]> Acked-by: Jason Wang <[email protected]> Reviewed-by: Stefano Garzarella <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 0686082 commit 7f05630

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/vhost/vdpa.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,13 @@ static void vhost_vdpa_unsetup_vq_irq(struct vhost_vdpa *v, u16 qid)
116116
irq_bypass_unregister_producer(&vq->call_ctx.producer);
117117
}
118118

119-
static void vhost_vdpa_reset(struct vhost_vdpa *v)
119+
static int vhost_vdpa_reset(struct vhost_vdpa *v)
120120
{
121121
struct vdpa_device *vdpa = v->vdpa;
122122

123-
vdpa_reset(vdpa);
124123
v->in_batch = 0;
124+
125+
return vdpa_reset(vdpa);
125126
}
126127

127128
static long vhost_vdpa_get_device_id(struct vhost_vdpa *v, u8 __user *argp)
@@ -865,7 +866,9 @@ static int vhost_vdpa_open(struct inode *inode, struct file *filep)
865866
return -EBUSY;
866867

867868
nvqs = v->nvqs;
868-
vhost_vdpa_reset(v);
869+
r = vhost_vdpa_reset(v);
870+
if (r)
871+
goto err;
869872

870873
vqs = kmalloc_array(nvqs, sizeof(*vqs), GFP_KERNEL);
871874
if (!vqs) {

0 commit comments

Comments
 (0)