summaryrefslogtreecommitdiff
path: root/net.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-21 19:56:08 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-21 19:56:08 +0000
commite8f1f9db8787be08e0ae3ed5a94da68966dbfff1 (patch)
tree67cd39d8098098f49ed0d0843c486b37db7bccce /net.c
parent0b1bcb00fb2baf5f3227dd9cd849fa69bf50d7a8 (diff)
downloadqemu-e8f1f9db8787be08e0ae3ed5a94da68966dbfff1.tar.gz
net: Check device passed to host_net_remove (Jan Kiszka)
Make sure that we do not delete guest NICs via host_net_remove. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7195 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'net.c')
-rw-r--r--net.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/net.c b/net.c
index 3cd6277767..7a1b2dfa2b 100644
--- a/net.c
+++ b/net.c
@@ -1858,14 +1858,20 @@ void net_host_device_remove(Monitor *mon, int vlan_id, const char *device)
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);
}