From: Dan Carpenter dan.carpenter@linaro.org
mainline inclusion from mainline-v6.7-rc2 commit e07754e0a1ea2d63fb29574253d1fd7405607343 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9RFM2 CVE: CVE-2023-52795
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id...
--------------------------------
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 Signed-off-by: Wei Li liwei391@huawei.com --- drivers/vhost/vdpa.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index c9b105977b11..cdcada1e2b9b 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -1703,7 +1703,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; }