[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL v2 02/16] block: fix permission update in bdrv_replac
From: |
Max Reitz |
Subject: |
[Qemu-block] [PULL v2 02/16] block: fix permission update in bdrv_replace_node |
Date: |
Tue, 3 Sep 2019 15:35:39 +0200 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
It's wrong to OR shared permissions. It may lead to crash on further
permission updates.
Also, no needs to consider previously calculated permissions, as at
this point we already bind all new parents and bdrv_get_cumulative_perm
result is enough. So fix the bug by just set permissions by
bdrv_get_cumulative_perm result.
Bug was introduced in long ago 234ac1a9025, in 2.9.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index 874a29a983..5944124845 100644
--- a/block.c
+++ b/block.c
@@ -4165,7 +4165,6 @@ void bdrv_replace_node(BlockDriverState *from,
BlockDriverState *to,
{
BdrvChild *c, *next;
GSList *list = NULL, *p;
- uint64_t old_perm, old_shared;
uint64_t perm = 0, shared = BLK_PERM_ALL;
int ret;
@@ -4211,8 +4210,8 @@ void bdrv_replace_node(BlockDriverState *from,
BlockDriverState *to,
bdrv_unref(from);
}
- bdrv_get_cumulative_perm(to, &old_perm, &old_shared);
- bdrv_set_perm(to, old_perm | perm, old_shared | shared);
+ bdrv_get_cumulative_perm(to, &perm, &shared);
+ bdrv_set_perm(to, perm, shared);
out:
g_slist_free(list);
--
2.21.0
[Qemu-block] [PULL v2 02/16] block: fix permission update in bdrv_replace_node,
Max Reitz <=
[Qemu-block] [PULL v2 03/16] block: posix: Always allocate the first block, Max Reitz, 2019/09/03
[Qemu-block] [PULL v2 04/16] iotests: Test allocate_first_block() with O_DIRECT, Max Reitz, 2019/09/03
[Qemu-block] [PULL v2 05/16] iotests: Fix _filter_img_create(), Max Reitz, 2019/09/03
[Qemu-block] [PULL v2 07/16] iotests: Keep testing broken relative extent paths, Max Reitz, 2019/09/03
[Qemu-block] [PULL v2 08/16] vmdk: Reject invalid compressed writes, Max Reitz, 2019/09/03
[Qemu-block] [PULL v2 06/16] vmdk: Use bdrv_dirname() for relative extent paths, Max Reitz, 2019/09/03
[Qemu-block] [PULL v2 09/16] iotests: Disable broken streamOptimized tests, Max Reitz, 2019/09/03
[Qemu-block] [PULL v2 10/16] iotests: Disable 110 for vmdk.twoGbMaxExtentSparse, Max Reitz, 2019/09/03
[Qemu-block] [PULL v2 11/16] iotests: Disable 126 for flat vmdk subformats, Max Reitz, 2019/09/03
[Qemu-block] [PULL v2 12/16] file-posix: fix request_alignment typo, Max Reitz, 2019/09/03