qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 3/7] net: Check device passed to host_net_remove


From: Jan Kiszka
Subject: [Qemu-devel] [PATCH 3/7] net: Check device passed to host_net_remove
Date: Tue, 14 Apr 2009 19:29:54 +0200
User-agent: StGIT/0.14.2

Make sure that we do not delete guest NICs via host_net_remove.

Signed-off-by: Jan Kiszka <address@hidden>
---

 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;
+    }
+
+    for (vc = vlan->first_client; vc != NULL; vc = vc->next) {
+        if (!strcmp(vc->name, device)) {
             break;
+        }
+    }
 
     if (!vc) {
         monitor_printf(mon, "can't find device %s\n", device);





reply via email to

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