Merge remote-tracking branch 'stefanha/net' into staging
# By Jason Wang (1) and Stefan Hajnoczi (1) # Via Stefan Hajnoczi * stefanha/net: tap: fix NULL dereference when passing invalid parameters to tap vmxnet3: fix NICState cleanup Message-id: 1370613288-14933-1-git-send-email-stefanha@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
		
						commit
						97f31cbc71
					
				@ -1892,7 +1892,7 @@ static void vmxnet3_net_uninit(VMXNET3State *s)
 | 
				
			|||||||
    vmxnet_tx_pkt_reset(s->tx_pkt);
 | 
					    vmxnet_tx_pkt_reset(s->tx_pkt);
 | 
				
			||||||
    vmxnet_tx_pkt_uninit(s->tx_pkt);
 | 
					    vmxnet_tx_pkt_uninit(s->tx_pkt);
 | 
				
			||||||
    vmxnet_rx_pkt_uninit(s->rx_pkt);
 | 
					    vmxnet_rx_pkt_uninit(s->rx_pkt);
 | 
				
			||||||
    qemu_del_net_client(qemu_get_queue(s->nic));
 | 
					    qemu_del_nic(s->nic);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void vmxnet3_net_init(VMXNET3State *s)
 | 
					static void vmxnet3_net_init(VMXNET3State *s)
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										18
									
								
								net/tap.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								net/tap.c
									
									
									
									
									
								
							@ -698,9 +698,10 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
 | 
				
			|||||||
    if (tap->has_fd) {
 | 
					    if (tap->has_fd) {
 | 
				
			||||||
        if (tap->has_ifname || tap->has_script || tap->has_downscript ||
 | 
					        if (tap->has_ifname || tap->has_script || tap->has_downscript ||
 | 
				
			||||||
            tap->has_vnet_hdr || tap->has_helper || tap->has_queues ||
 | 
					            tap->has_vnet_hdr || tap->has_helper || tap->has_queues ||
 | 
				
			||||||
            tap->has_fds) {
 | 
					            tap->has_fds || tap->has_vhostfds) {
 | 
				
			||||||
            error_report("ifname=, script=, downscript=, vnet_hdr=, "
 | 
					            error_report("ifname=, script=, downscript=, vnet_hdr=, "
 | 
				
			||||||
                         "helper=, queues=, and fds= are invalid with fd=");
 | 
					                         "helper=, queues=, fds=, and vhostfds= "
 | 
				
			||||||
 | 
					                         "are invalid with fd=");
 | 
				
			||||||
            return -1;
 | 
					            return -1;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -725,9 +726,10 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (tap->has_ifname || tap->has_script || tap->has_downscript ||
 | 
					        if (tap->has_ifname || tap->has_script || tap->has_downscript ||
 | 
				
			||||||
            tap->has_vnet_hdr || tap->has_helper || tap->has_queues ||
 | 
					            tap->has_vnet_hdr || tap->has_helper || tap->has_queues ||
 | 
				
			||||||
            tap->has_fd) {
 | 
					            tap->has_vhostfd) {
 | 
				
			||||||
            error_report("ifname=, script=, downscript=, vnet_hdr=, "
 | 
					            error_report("ifname=, script=, downscript=, vnet_hdr=, "
 | 
				
			||||||
                         "helper=, queues=, and fd= are invalid with fds=");
 | 
					                         "helper=, queues=, and vhostfd= "
 | 
				
			||||||
 | 
					                         "are invalid with fds=");
 | 
				
			||||||
            return -1;
 | 
					            return -1;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -765,9 +767,9 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    } else if (tap->has_helper) {
 | 
					    } else if (tap->has_helper) {
 | 
				
			||||||
        if (tap->has_ifname || tap->has_script || tap->has_downscript ||
 | 
					        if (tap->has_ifname || tap->has_script || tap->has_downscript ||
 | 
				
			||||||
            tap->has_vnet_hdr || tap->has_queues || tap->has_fds) {
 | 
					            tap->has_vnet_hdr || tap->has_queues || tap->has_vhostfds) {
 | 
				
			||||||
            error_report("ifname=, script=, downscript=, and vnet_hdr= "
 | 
					            error_report("ifname=, script=, downscript=, and vnet_hdr= "
 | 
				
			||||||
                         "queues=, and fds= are invalid with helper=");
 | 
					                         "queues=, and vhostfds= are invalid with helper=");
 | 
				
			||||||
            return -1;
 | 
					            return -1;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -785,6 +787,10 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
 | 
				
			|||||||
            return -1;
 | 
					            return -1;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
 | 
					        if (tap->has_vhostfds) {
 | 
				
			||||||
 | 
					            error_report("vhostfds= is invalid if fds= wasn't specified");
 | 
				
			||||||
 | 
					            return -1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        script = tap->has_script ? tap->script : DEFAULT_NETWORK_SCRIPT;
 | 
					        script = tap->has_script ? tap->script : DEFAULT_NETWORK_SCRIPT;
 | 
				
			||||||
        downscript = tap->has_downscript ? tap->downscript :
 | 
					        downscript = tap->has_downscript ? tap->downscript :
 | 
				
			||||||
            DEFAULT_NETWORK_DOWN_SCRIPT;
 | 
					            DEFAULT_NETWORK_DOWN_SCRIPT;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user