From: Jason Wang <jasowang@redhat.com>
To: Thomas Huth <thuth@redhat.com>, Lin Ma <lma@suse.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3] net: Fix a potential segfault
Date: Tue, 12 Jun 2018 10:03:47 +0800 [thread overview]
Message-ID: <62828958-4df4-fc81-d1a3-1eb5a310d5af@redhat.com> (raw)
In-Reply-To: <5cac7e34-4f6f-99f1-a75f-7a2b57d3cb34@redhat.com>
On 2018年06月11日 17:48, Thomas Huth wrote:
> On 11.06.2018 11:23, Lin Ma wrote:
>> If user forgets to provide any backend types for '-netdev' in qemu CLI,
>> It triggers seg fault.
>>
>> e.g.
>>
>> Expected:
>> $ qemu -netdev id=net0
>> qemu-system-x86_64: Parameter 'type' is missing
>>
>> Actual:
>> $ qemu -netdev id=net0
>> Segmentation fault (core dumped)
>>
>> Signed-off-by: Lin Ma <lma@suse.com>
>> ---
>> net/net.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/net.c b/net/net.c
>> index efb9eaf779..2a3133990c 100644
>> --- a/net/net.c
>> +++ b/net/net.c
>> @@ -1093,7 +1093,9 @@ static int net_client_init(QemuOpts *opts, bool is_netdev, Error **errp)
>> int ret = -1;
>> Visitor *v = opts_visitor_new(opts);
>>
>> - if (is_netdev && is_help_option(qemu_opt_get(opts, "type"))) {
>> + const char *type = qemu_opt_get(opts, "type");
>> +
>> + if (is_netdev && type && is_help_option(type)) {
>> show_netdevs();
>> exit(0);
>> } else {
>>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
Applied, and queued for -stable.
Thanks
prev parent reply other threads:[~2018-06-12 2:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-11 9:23 [Qemu-devel] [PATCH v3] net: Fix a potential segfault Lin Ma
2018-06-11 9:48 ` Thomas Huth
2018-06-12 2:03 ` Jason Wang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=62828958-4df4-fc81-d1a3-1eb5a310d5af@redhat.com \
--to=jasowang@redhat.com \
--cc=lma@suse.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).