aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2023-10-27 15:12:54 +0300
committerMichael S. Tsirkin <mst@redhat.com>2023-11-01 09:31:16 -0400
commite07754e0a1ea2d63fb29574253d1fd7405607343 (patch)
tree13eebdfea0eaf734901829b35598818af45a3f31 /drivers/vhost
parentb2c8b644fac1087dfe69a1762c04df090178a5ae (diff)
downloadlinux-e07754e0a1ea2d63fb29574253d1fd7405607343.tar.gz
vhost-vdpa: fix use after free in vhost_vdpa_probe()
The put_device() calls vhost_vdpa_release_dev() which calls ida_simple_remove() and frees "v". So this call to ida_simple_remove() is a use after free and a double free. Fixes: ebe6a354fa7e ("vhost-vdpa: Call ida_simple_remove() when failed") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Message-Id: <cf53cb61-0699-4e36-a980-94fd4268ff00@moroto.mountain> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/vdpa.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 30df5c58db73a8..da7ec77cdaff07 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -1582,7 +1582,6 @@ static int vhost_vdpa_probe(struct vdpa_device *vdpa)
err:
put_device(&v->dev);
- ida_simple_remove(&vhost_vdpa_ida, v->minor);
return r;
}