]> git.itanic.dy.fi Git - linux-stable/commitdiff
vhost-vdpa: fix use after free in vhost_vdpa_probe()
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 27 Oct 2023 12:12:54 +0000 (15:12 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 1 Nov 2023 13:31:16 +0000 (09:31 -0400)
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>
drivers/vhost/vdpa.c

index 30df5c58db73a846dc3c58ad821201694869a348..da7ec77cdaff075b5e66a21be7693cd6b7d30047 100644 (file)
@@ -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;
 }