[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 43/46] block: Assertions for write permissions
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 43/46] block: Assertions for write permissions |
Date: |
Tue, 28 Feb 2017 21:36:42 +0100 |
This adds assertions that ensure that the necessary write permissions
have been granted before someone attempts to write to a node.
Signed-off-by: Kevin Wolf <address@hidden>
Acked-by: Fam Zheng <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
---
block/io.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/io.c b/block/io.c
index 2592ca1..4c79745 100644
--- a/block/io.c
+++ b/block/io.c
@@ -945,6 +945,8 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild
*child,
size_t skip_bytes;
int ret;
+ assert(child->perm & (BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE));
+
/* Cover entire cluster so no additional backing file I/O is required when
* allocating cluster in the image file.
*/
@@ -1336,6 +1338,7 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild
*child,
assert(!waited || !req->serialising);
assert(req->overlap_offset <= offset);
assert(offset + bytes <= req->overlap_offset + req->overlap_bytes);
+ assert(child->perm & BLK_PERM_WRITE);
ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req);
--
1.8.3.1
- [Qemu-block] [PULL 33/46] blockjob: Factor out block_job_remove_all_bdrv(), (continued)
- [Qemu-block] [PULL 33/46] blockjob: Factor out block_job_remove_all_bdrv(), Kevin Wolf, 2017/02/28
- [Qemu-block] [PULL 32/46] block: Allow backing file links in change_parent_backing_link(), Kevin Wolf, 2017/02/28
- [Qemu-block] [PULL 35/46] stream: Use real permissions in streaming block job, Kevin Wolf, 2017/02/28
- [Qemu-block] [PULL 34/46] mirror: Use real permissions in mirror/active commit block job, Kevin Wolf, 2017/02/28
- [Qemu-block] [PULL 36/46] mirror: Add filter-node-name to blockdev-mirror, Kevin Wolf, 2017/02/28
- [Qemu-block] [PULL 37/46] commit: Add filter-node-name to block-commit, Kevin Wolf, 2017/02/28
- [Qemu-block] [PULL 38/46] hmp: Request permissions in qemu-io, Kevin Wolf, 2017/02/28
- [Qemu-block] [PULL 39/46] migration/block: Use real permissions, Kevin Wolf, 2017/02/28
- [Qemu-block] [PULL 40/46] nbd/server: Use real permissions for NBD exports, Kevin Wolf, 2017/02/28
- [Qemu-block] [PULL 41/46] tests: Remove FIXME comments, Kevin Wolf, 2017/02/28
- [Qemu-block] [PULL 43/46] block: Assertions for write permissions,
Kevin Wolf <=
- [Qemu-block] [PULL 42/46] block: Pass BdrvChild to bdrv_aligned_preadv/pwritev and copy-on-read, Kevin Wolf, 2017/02/28
- [Qemu-block] [PULL 44/46] block: Assertions for resize permission, Kevin Wolf, 2017/02/28
- [Qemu-block] [PULL 45/46] block: Add Error parameter to bdrv_set_backing_hd(), Kevin Wolf, 2017/02/28
- [Qemu-block] [PULL 46/46] block: Add Error parameter to bdrv_append(), Kevin Wolf, 2017/02/28