summary refs log tree commit diff stats
path: root/util/bufferiszero.c
diff options
context:
space:
mode:
authorHanna Reitz <hreitz@redhat.com>2021-11-25 14:53:16 +0100
committerHanna Reitz <hreitz@redhat.com>2022-02-01 10:51:39 +0100
commit492a119610129f65217580790971fa038e5492d3 (patch)
tree5991e05aaf0343e1c9153a21579d3c7292b001ea /util/bufferiszero.c
parente287a351db13f3f6670f4a3f2896f2dde47d07d1 (diff)
downloadfocaccia-qemu-492a119610129f65217580790971fa038e5492d3.tar.gz
focaccia-qemu-492a119610129f65217580790971fa038e5492d3.zip
block-backend: Retain permissions after migration
After migration, the permissions the guest device wants to impose on its
BlockBackend are stored in blk->perm and blk->shared_perm.  In
blk_root_activate(), we take our permissions, but keep all shared
permissions open by calling `blk_set_perm(blk->perm, BLK_PERM_ALL)`.

Only afterwards (immediately or later, depending on the runstate) do we
restrict the shared permissions by calling
`blk_set_perm(blk->perm, blk->shared_perm)`.  Unfortunately, our first
call with shared_perm=BLK_PERM_ALL has overwritten blk->shared_perm to
be BLK_PERM_ALL, so this is a no-op and the set of shared permissions is
not restricted.

Fix this bug by saving the set of shared permissions before invoking
blk_set_perm() with BLK_PERM_ALL and restoring it afterwards.

Fixes: 5f7772c4d0cf32f4e779fcd5a69ae4dae24aeebf
       ("block-backend: Defer shared_perm tightening migration
       completion")
Reported-by: Peng Liang <liangpeng10@huawei.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20211125135317.186576-2-hreitz@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Peng Liang <liangpeng10@huawei.com>
Diffstat (limited to 'util/bufferiszero.c')
0 files changed, 0 insertions, 0 deletions