From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lu5iu-00006Z-6l for qemu-devel@nongnu.org; Wed, 15 Apr 2009 10:04:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lu5ip-00004s-Is for qemu-devel@nongnu.org; Wed, 15 Apr 2009 10:04:19 -0400 Received: from [199.232.76.173] (port=45289 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lu5ip-0008WP-DW for qemu-devel@nongnu.org; Wed, 15 Apr 2009 10:04:15 -0400 Received: from gecko.sbs.de ([194.138.37.40]:24548) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lu5io-00037S-Qy for qemu-devel@nongnu.org; Wed, 15 Apr 2009 10:04:15 -0400 Message-ID: <49E5E95C.1080705@siemens.com> Date: Wed, 15 Apr 2009 16:04:12 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <20090414172954.15035.73053.stgit@mchn012c.ww002.siemens.net> <20090414172954.15035.26655.stgit@mchn012c.ww002.siemens.net> <1239800987.4431.129.camel@blaa> In-Reply-To: <1239800987.4431.129.camel@blaa> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 3/7] net: Check device passed to host_net_remove Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mark McLoughlin , qemu-devel@nongnu.org Mark McLoughlin wrote: > 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? Good point. > > Probably makes more sense to find the client, then check vc->model using > net_host_check_device()? Yes, will fix. Thanks, Jan -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux