mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
vhost: Build temporary section list and deref after commit
Igor spotted that there's a race, where a region that's unref'd in a _del callback might be free'd before the set_mem_table call in the _commit callback, and thus the vhost might end up using free memory. Fix this by building a complete temporary sections list, ref'ing every section (during add and nop) and then unref'ing the whole list right at the end of commit. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
710fccf80d
commit
c44317efec
2 changed files with 49 additions and 26 deletions
|
@ -60,6 +60,8 @@ struct vhost_dev {
|
|||
struct vhost_memory *mem;
|
||||
int n_mem_sections;
|
||||
MemoryRegionSection *mem_sections;
|
||||
int n_tmp_sections;
|
||||
MemoryRegionSection *tmp_sections;
|
||||
struct vhost_virtqueue *vqs;
|
||||
int nvqs;
|
||||
/* the first virtqueue which would be used by this vhost dev */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue