qdev-properties-system.c: Allow vlan or netdev for -device, not both
It is currently possible to specify things like: -device e1000,netdev=foo,vlan=1 With this usage, whichever argument was specified last (vlan or netdev) overwrites what was previousely set and results in a non-working configuration. Even worse, when used with multiqueue devices, it causes a segmentation fault on exit in qemu_free_net_client. That patch treates the above command line options as invalid and generates an error at start-up. Signed-off-by: Vlad Yasevich <vyasevic@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
		
							parent
							
								
									607bb022f2
								
							
						
					
					
						commit
						30c367ed44
					
				@ -205,6 +205,11 @@ static int parse_netdev(DeviceState *dev, const char *str, void **ptr)
 | 
			
		||||
            goto err;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (ncs[i]) {
 | 
			
		||||
            ret = -EINVAL;
 | 
			
		||||
            goto err;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ncs[i] = peers[i];
 | 
			
		||||
        ncs[i]->queue_index = i;
 | 
			
		||||
    }
 | 
			
		||||
@ -301,6 +306,10 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque,
 | 
			
		||||
        *ptr = NULL;
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    if (*ptr) {
 | 
			
		||||
        error_set_from_qdev_prop_error(errp, -EINVAL, dev, prop, name);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    hubport = net_hub_port_find(id);
 | 
			
		||||
    if (!hubport) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user