qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 3/3] blockdev: do not open block device if pa


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v4 3/3] blockdev: do not open block device if password is not required but user provides one
Date: Wed, 3 Jul 2013 12:31:14 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Jun 24, 2013 at 02:12:52PM +0200, Pavel Hrdina wrote:
> This fixes the issue that block device is openned successfully with an error
> as warning if password is provided but not required. Now the open fails with
> the error message.
> 
> Signed-off-by: Pavel Hrdina <address@hidden>
> ---
>  blockdev.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/blockdev.c b/blockdev.c
> index 2dbd781..7fc8dcf 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -1065,6 +1065,11 @@ static void qmp_bdrv_open_encrypted(BlockDriverState 
> *bs, const char *filename,
>  {
>      int ret;
>  
> +    if (!bdrv_key_required(bs) && password) {
> +        error_set(errp, QERR_DEVICE_NOT_ENCRYPTED, bdrv_get_device_name(bs));
> +        return;
> +    }
> +
>      ret = bdrv_open(bs, filename, NULL, bdrv_flags, drv);

How can bdrv_key_required(bs) work when bs isn't opened yet?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]