qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] qemu_opt_foreach: Fix crasher


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] qemu_opt_foreach: Fix crasher
Date: Tue, 16 Aug 2016 17:25:49 +0100

On 16 August 2016 at 16:17, Michal Privoznik <address@hidden> wrote:
> The solution is to teach qemu_opt_foreach() to take a shortcut if
> @opts is NULL.
>
> Signed-off-by: Michal Privoznik <address@hidden>
> ---
>
> Even after this patch I'm still unable to attach vhost-user:
>
> {"id": "libvirt-20", "error": {"class": "GenericError", "desc": "chardev 
> \"charnet2\" is not a unix socket"}}
>
> But at least, qemu does not crash anymore.
>
>  util/qemu-option.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/util/qemu-option.c b/util/qemu-option.c
> index 3467dc2..78be7e1 100644
> --- a/util/qemu-option.c
> +++ b/util/qemu-option.c
> @@ -614,6 +614,11 @@ int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc 
> func, void *opaque,
>      QemuOpt *opt;
>      int rc;
>
> +    if (!opts) {
> +        /* Done, trivially. */
> +        return 0;
> +    }
> +
>      QTAILQ_FOREACH(opt, &opts->head, next) {
>          rc = func(opaque, opt->name, opt->str, errp);
>          if (rc) {
> --
> 2.8.4

This seems plausible, but I don't understand our option
code very well, and we seem to have a mix of "check for
NULL" and "caller had better not pass NULL" in the various
functions in util/qemu-option.c.

Markus: how is this supposed to work?

In any case something is clearly still busted in the
vhost-user code, because it's expecting to get a non-NULL
opts so it can properly parse the chardev, so that seems
like the thing we really need to fix.

thanks
-- PMM



reply via email to

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