diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2023-10-27 15:12:54 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-11-28 20:07:04 +0300 |
commit | c0f8b8fb7df9d1a38652eb5aa817afccd3c56111 (patch) | |
tree | 1b83465b797f75e6c9fc36acdcc754c2205bdce3 /drivers/vhost | |
parent | 58278cc71d34023b6534d33ab47bc07b91ce8d96 (diff) | |
download | linux-c0f8b8fb7df9d1a38652eb5aa817afccd3c56111.tar.xz |
vhost-vdpa: fix use after free in vhost_vdpa_probe()
[ Upstream commit 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: 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: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/vdpa.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 31a156669a53..c8374527a27d 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -1427,7 +1427,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; } |