Skip to contentSkip to conversation

[7205] 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: 7205

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7205
Author:   aliguori
Date:     2009-04-21 20:47:51 +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:
--------------

    branches/stable_0_10/net.c

Modified: branches/stable_0_10/net.c
===================================================================

stable_0_10/net.c +8 -2
@@ -1854,14 +1854,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) {
         term_printf("can't find device %s\n", device);
         return;
     }
+    if (!net_host_check_device(vc->model)) {
+        term_printf("invalid host network device %s\n", device);
+        return;
+    }
     qemu_del_vlan_client(vc);
 }