diff options
author | Kevin Wolf <kwolf@redhat.com> | 2014-06-04 15:09:35 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-06-26 13:51:01 +0200 |
commit | 8ee79e707a005c9274df7ce34265bb7d008b8cef (patch) | |
tree | f8402fad14af55bef4457d8a5888db05d1d11fec /block.c | |
parent | 76c591b013782217cad67b35c74cd249e0413439 (diff) |
block: Catch backing files assigned to non-COW drivers
Since we parse backing.* options to add a backing file from the command
line when the driver didn't assign one, it has been possible to have a
backing file for e.g. raw images (it just was never accessed).
This is obvious nonsense and should be rejected.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1192,6 +1192,13 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp) bdrv_get_full_backing_filename(bs, backing_filename, PATH_MAX); } + if (!bs->drv || !bs->drv->supports_backing) { + ret = -EINVAL; + error_setg(errp, "Driver doesn't support backing files"); + QDECREF(options); + goto free_exit; + } + backing_hd = bdrv_new("", errp); if (bs->backing_format[0] != '\0') { |