qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] net: validate that ids are well formed


From: Jason Wang
Subject: Re: [PATCH] net: validate that ids are well formed
Date: Tue, 2 Mar 2021 13:55:44 +0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.8.0


On 2021/3/1 11:07 下午, Eric Blake wrote:
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>


Queued.

Thanks







reply via email to

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