mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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>
This commit is contained in:
parent
f05b328c9d
commit
06d22aa367
3 changed files with 21 additions and 0 deletions
5
block.c
5
block.c
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue