[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] net: validate that ids are well formed
From: |
Eric Blake |
Subject: |
Re: [PATCH] net: validate that ids are well formed |
Date: |
Mon, 1 Mar 2021 09:07:40 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 |
On 3/1/21 8:56 AM, Paolo Bonzini wrote:
> When a network or network device is created from the command line or HMP,
> QemuOpts ensures that the id passes the id_wellformed check. However,
> QMP skips this:
>
> $ qemu-system-x86_64 -qmp stdio -S -nic user,id=123/456
> qemu-system-x86_64: -nic user,id=123/456: Parameter id expects an
> identifier
> Identifiers consist of letters, digits, -, ., _, starting with a letter.
>
> $ qemu-system-x86_64 -qmp stdio -S
> {"execute":"qmp_capabilities"}
> {"return": {}}
> {"execute":"netdev_add", "arguments": {"type": "user", "id": "123/456"}}
> {"return": {}}
>
> After:
>
> $ qemu-system-x86_64 -qmp stdio -S
> {"execute":"qmp_capabilities"}
> {"return": {}}
> {"execute":"netdev_add", "arguments": {"type": "user", "id": "123/456"}}
> {"error": {"class": "GenericError", "desc": "Parameter "id" expects an
> identifier"}}
>
> Validity checks should be performed always at the bottom of the call chain,
> because QMP skips all the steps above. Do this for the network subsystem.
>
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> net/net.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org