Skip to content

Commit

Permalink
vduse: Cleanup the old kernel states after reset failure
Browse files Browse the repository at this point in the history
We should cleanup the old kernel states e.g. interrupt callback
no matter whether the userspace handle the reset correctly or not
since virtio-vdpa can't handle the reset failure now.

Otherwise, the old state might be used after reset which might
break something, e.g. the old interrupt callback might be triggered
by userspace after reset, which can break the virtio device driver.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Link: https://lore.kernel.org/r/20210906142158.181-1-xieyongji@bytedance.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
  • Loading branch information
Xie Yongji authored and Michael S. Tsirkin committed Sep 14, 2021
1 parent 6243e3c commit 7bb5fb2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/vdpa/vdpa_user/vduse_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,13 +665,11 @@ static void vduse_vdpa_set_config(struct vdpa_device *vdpa, unsigned int offset,
static int vduse_vdpa_reset(struct vdpa_device *vdpa)
{
struct vduse_dev *dev = vdpa_to_vduse(vdpa);

if (vduse_dev_set_status(dev, 0))
return -EIO;
int ret = vduse_dev_set_status(dev, 0);

vduse_dev_reset(dev);

return 0;
return ret;
}

static u32 vduse_vdpa_get_generation(struct vdpa_device *vdpa)
Expand Down

0 comments on commit 7bb5fb2

Please sign in to comment.