[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.7? 1/5] block/ssh: Use QemuOpts for runtim
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH for-2.7? 1/5] block/ssh: Use QemuOpts for runtime options |
Date: |
Mon, 15 Aug 2016 11:20:28 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 12.08.2016 um 19:15 hat Max Reitz geschrieben:
> Using QemuOpts will prevent qemu from crashing if the input options have
> not been validated (which is the case when they are specified on the
> command line or in a json: filename) and some have the wrong type.
>
> Signed-off-by: Max Reitz <address@hidden>
> ---
> block/ssh.c | 77
> ++++++++++++++++++++++++++++++++++++++++++-------------------
> 1 file changed, 53 insertions(+), 24 deletions(-)
>
> diff --git a/block/ssh.c b/block/ssh.c
> index bcbb0e4..4b90f34 100644
> --- a/block/ssh.c
> +++ b/block/ssh.c
> @@ -508,36 +508,73 @@ static int authenticate(BDRVSSHState *s, const char
> *user, Error **errp)
> return ret;
> }
>
> +static QemuOptsList runtime_opts = {
I would generally prefer some prefix to make the name unique instead of
having something called "runtime_opts" in every driver. Currently we're
inconsistent, but most driver do use a prefix.
> @@ -618,15 +654,6 @@ static int connect_to_ssh(BDRVSSHState *s, QDict
> *options,
> return -EINVAL;
> }
>
> - /* Delete the options we've used; any not deleted will cause the
> - * block layer to give an error about unused options.
> - */
> - qdict_del(options, "host");
> - qdict_del(options, "port");
> - qdict_del(options, "user");
> - qdict_del(options, "path");
> - qdict_del(options, "host_key_check");
> -
> return 0;
>
> err:
> @@ -646,6 +673,8 @@ static int connect_to_ssh(BDRVSSHState *s, QDict *options,
> }
> s->session = NULL;
>
> + qemu_opts_del(opts);
> +
> return ret;
> }
opts is leaked in the normal path and only freed on error.
Kevin
- [Qemu-devel] [PATCH for-2.7? 0/5] block: Use QemuOpts for runtime options, Max Reitz, 2016/08/12
- [Qemu-devel] [PATCH for-2.7? 1/5] block/ssh: Use QemuOpts for runtime options, Max Reitz, 2016/08/12
- Re: [Qemu-devel] [PATCH for-2.7? 1/5] block/ssh: Use QemuOpts for runtime options,
Kevin Wolf <=
- [Qemu-devel] [PATCH for-2.7? 3/5] block/blkdebug: Store config filename, Max Reitz, 2016/08/12
- [Qemu-devel] [PATCH for-2.7? 4/5] block/nbd: Store runtime option values, Max Reitz, 2016/08/12
- [Qemu-devel] [PATCH for-2.7? 5/5] iotests: Test case for wrong runtime option types, Max Reitz, 2016/08/12
- [Qemu-devel] [PATCH for-2.7? 2/5] block/nbd: Use QemuOpts for runtime options, Max Reitz, 2016/08/12
- Re: [Qemu-devel] [PATCH for-2.7? 0/5] block: Use QemuOpts for runtime options, Kevin Wolf, 2016/08/15