Skip to contentSkip to conversation

[7195] net: Check device passed to host_net_remove (Jan Kiszka)

Qemu-devel Anthony Liguori 1 participant 1 message Apr 21, 2009

lore
Share & tools
lore
#0 lore raw

Revision: 7195

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7195
Author:   aliguori
Date:     2009-04-21 19:56:08 +0000 (Tue, 21 Apr 2009)

Log Message:
-----------
net: Check device passed to host_net_remove (Jan Kiszka)

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

Modified Paths:
--------------
trunk/net.c

Modified: trunk/net.c
===================================================================

net.c +8 -2
@@ -1858,14 +1858,20 @@
 
     vlan = qemu_find_vlan(vlan_id);
 
-   for(vc = vlan->first_client; vc != NULL; vc = vc->next)
-        if (!strcmp(vc->name, device))
+    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);
         return;
     }
+    if (!net_host_check_device(vc->model)) {
+        monitor_printf(mon, "invalid host network device %s\n", device);
+        return;
+    }
     qemu_del_vlan_client(vc);
 }