]> git.proxmox.com Git - mirror_qemu.git/commitdiff
block/crypto: disallow write sharing by default
authorMaxim Levitsky <mlevitsk@redhat.com>
Sun, 19 Jul 2020 12:20:58 +0000 (15:20 +0300)
committerMax Reitz <mreitz@redhat.com>
Tue, 21 Jul 2020 08:49:02 +0000 (10:49 +0200)
My commit 'block/crypto: implement the encryption key management'
accidently allowed raw luks images to be shared between different
qemu processes without share-rw=on explicit override.
Fix that.

Fixes: bbfdae91fb ("block/crypto: implement the encryption key management")
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1857490

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20200719122059.59843-2-mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/crypto.c

index 8725c1bc021f1e41266e8e633061ad4c679ebed6..08075577631d3c8f4fde480d96e4b324b317b9f5 100644 (file)
@@ -881,7 +881,7 @@ block_crypto_child_perms(BlockDriverState *bs, BdrvChild *c,
      * For backward compatibility, manually share the write
      * and resize permission
      */
-    *nshared |= (BLK_PERM_WRITE | BLK_PERM_RESIZE);
+    *nshared |= shared & (BLK_PERM_WRITE | BLK_PERM_RESIZE);
     /*
      * Since we are not fully a format driver, don't always request
      * the read/resize permission but only when explicitly