Skip to contentSkip to conversation

host_device_remove: remove incorrect check for device name

PATCH Applied Eduardo Habkost 3 participants 3 messages Mar 19, 2009 – Mar 28, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 host_device_remove: remove incorrect check for device name

There is no need to check for valid prefixes on the the device name when removing it. If the device name is found on the vlan client list, it can be removed, regardless of the prefix used on its name.

To reproduce the bug, just run this on the monitor:

(qemu) host_net_add user name=foobar
(qemu) host_net_remove 0 foobar
invalid host network device foobar
(qemu)

---
 net.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
net.c +0 -5
index c853daf..395ee4f 100644
@@ -1822,11 +1822,6 @@ void net_host_device_remove(Monitor *mon, int vlan_id, const char *device)
     VLANState *vlan;
     VLANClientState *vc;
 
-    if (!net_host_check_device(device)) {
-        monitor_printf(mon, "invalid host network device %s\n", device);
-        return;
-    }
-
     vlan = qemu_find_vlan(vlan_id);
     if (!vlan) {
         monitor_printf(mon, "can't find vlan %d\n", vlan_id);
Signature · 1 line
1.6.1
#1 lore raw

ACK, thanks Eduardo.

Quoted 36 lines · Eduardo Habkost

There is no need to check for valid prefixes on the the device name when removing it. If the device name is found on the vlan client list, it can be removed, regardless of the prefix used on its name.

To reproduce the bug, just run this on the monitor:

(qemu) host_net_add user name=foobar
(qemu) host_net_remove 0 foobar
invalid host network device foobar
(qemu)

---
 net.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
net.c +0 -5
index c853daf..395ee4f 100644
@@ -1822,11 +1822,6 @@ void net_host_device_remove(Monitor *mon, int vlan_id, const char *device)
     VLANState *vlan;
     VLANClientState *vc;
 
-    if (!net_host_check_device(device)) {
-        monitor_printf(mon, "invalid host network device %s\n", device);
-        return;
-    }
-
     vlan = qemu_find_vlan(vlan_id);
     if (!vlan) {
         monitor_printf(mon, "can't find vlan %d\n", vlan_id);
Signature · 1 line
1.6.1
#2 lore raw
In reply to Eduardo Habkost
Quoted 4 lines · Eduardo Habkost

There is no need to check for valid prefixes on the the device name when removing it. If the device name is found on the vlan client list, it can be removed, regardless of the prefix used on its name.

Quoted 9 lines

To reproduce the bug, just run this on the monitor:

(qemu) host_net_add user name=foobar
(qemu) host_net_remove 0 foobar
invalid host network device foobar
(qemu)

Applied to stable and trunk. Thanks.

Regards,

Anthony Liguori

Quoted 21 lines
---
 net.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
net.c +0 -5
index c853daf..395ee4f 100644
@@ -1822,11 +1822,6 @@ void net_host_device_remove(Monitor *mon, int vlan_id, const char *device)
     VLANState *vlan;
     VLANClientState *vc;
 
-    if (!net_host_check_device(device)) {
-        monitor_printf(mon, "invalid host network device %s\n", device);
-        return;
-    }
-
     vlan = qemu_find_vlan(vlan_id);
     if (!vlan) {
         monitor_printf(mon, "can't find vlan %d\n", vlan_id);