diff options
author | Kevin Wolf <kwolf@redhat.com> | 2013-08-08 17:44:52 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-11-15 13:37:48 +0100 |
commit | 06d22aa36706a3d6051b74c8a183ab554a0cb808 (patch) | |
tree | 273af77fd862596678604b75ead4dc86819fcdfd /block.c | |
parent | f05b328c9d85e57ab871ca73a36220493327a649 (diff) |
block: Fail if requested driver is not available
If an explicit driver option is present, but doesn't specify a valid
driver, then bdrv_open() should fail instead of probing the format.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1137,6 +1137,11 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, if (drvname) { drv = bdrv_find_format(drvname); qdict_del(options, "driver"); + if (!drv) { + error_setg(errp, "Invalid driver: '%s'", drvname); + ret = -EINVAL; + goto unlink_and_fail; + } } if (!drv) { |