Commit fde0ab16 authored by Dan Carpenter's avatar Dan Carpenter Committed by Wei Li
Browse files

vhost-vdpa: fix use after free in vhost_vdpa_probe()

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=e07754e0a1ea2d63fb29574253d1fd7405607343



--------------------------------

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: ebe6a354 ("vhost-vdpa: Call ida_simple_remove() when failed")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Message-Id: <cf53cb61-0699-4e36-a980-94fd4268ff00@moroto.mountain>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarWei Li <liwei391@huawei.com>
parent f300accf
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -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;
}