From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lu50E-0005ii-1s for qemu-devel@nongnu.org; Wed, 15 Apr 2009 09:18:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lu509-0005gk-4i for qemu-devel@nongnu.org; Wed, 15 Apr 2009 09:18:09 -0400 Received: from [199.232.76.173] (port=44432 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lu508-0005gh-V1 for qemu-devel@nongnu.org; Wed, 15 Apr 2009 09:18:04 -0400 Received: from mx2.redhat.com ([66.187.237.31]:56871) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lu508-0007dt-Jg for qemu-devel@nongnu.org; Wed, 15 Apr 2009 09:18:04 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n3FDI4nT029345 for ; Wed, 15 Apr 2009 09:18:04 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n3FDI3iN005639 for ; Wed, 15 Apr 2009 09:18:03 -0400 Received: from [127.0.0.1] (file.rdu.redhat.com [10.11.255.147]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n3FDI2Pb008221 for ; Wed, 15 Apr 2009 09:18:02 -0400 Subject: Re: [Qemu-devel] [PATCH 3/7] net: Check device passed to host_net_remove From: Mark McLoughlin In-Reply-To: <20090414172954.15035.26655.stgit@mchn012c.ww002.siemens.net> References: <20090414172954.15035.73053.stgit@mchn012c.ww002.siemens.net> <20090414172954.15035.26655.stgit@mchn012c.ww002.siemens.net> Content-Type: text/plain Date: Wed, 15 Apr 2009 14:09:47 +0100 Message-Id: <1239800987.4431.129.camel@blaa> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Reply-To: Mark McLoughlin , qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Tue, 2009-04-14 at 19:29 +0200, Jan Kiszka wrote: > Make sure that we do not delete guest NICs via host_net_remove. > > Signed-off-by: Jan Kiszka > --- > > net.c | 11 +++++++++-- > 1 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/net.c b/net.c > index 36c0509..787f249 100644 > --- a/net.c > +++ b/net.c > @@ -1861,9 +1861,16 @@ void net_host_device_remove(Monitor *mon, int vlan_id, const char *device) > return; > } > > - for(vc = vlan->first_client; vc != NULL; vc = vc->next) > - if (!strcmp(vc->name, device)) > + if (!net_host_check_device(device)) { > + monitor_printf(mon, "invalid host network device %s\n", device); > + return; > + } Doesn't this mean that if you assign a name with e.g. "name=foo1234" you won't be able to remove it? Probably makes more sense to find the client, then check vc->model using net_host_check_device()? Cheers, Mark.