Bug 735660

Summary: Field access results in a dereference of a null pointer (loaded from variable 'l_disk')
Product: Red Hat Enterprise Linux 6 Reporter: Alex Jia <ajia>
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: dallan, dyuan, rwu, veillard
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-08 06:38:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alex Jia 2011-09-04 16:56:14 UTC
Description of problem:
File:	src/libxl/libxl_driver.c
Location:	line 3017, column 17
Description:	Field access results in a dereference of a null pointer (loaded from variable 'l_disk')

2979	static int
2980	libxlDomainDetachDeviceDiskLive(libxlDomainObjPrivatePtr priv,
2981	virDomainObjPtr vm, virDomainDeviceDefPtr dev)
2982	{
2983	virDomainDiskDefPtr l_disk = NULL;

Notes: Variable 'l_disk' initialized to a null pointer value.

2989	switch (dev->data.disk->device) {

Notes: Control jumps to 'case VIR_DOMAIN_DISK_DEVICE_DISK:' at line 2990
    
2990	case VIR_DOMAIN_DISK_DEVICE_DISK:
2991	if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_XEN) {

Notes: Taking false branch

3016	} else {
3017	libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
3018	_("disk bus '%s' cannot be hot unplugged."),
3019	virDomainDiskBusTypeToString(l_disk->bus));

Notes: 	Within the expansion of the macro 'libxlError':
        Field access results in a dereference of a null 
        pointer (loaded from variable 'l_disk')


Version-Release number of selected component (if applicable):
libvirt upstream.

How reproducible:
always

Steps to Reproduce:
1. directly analyze libvirt soure codes 
   or using static codes analysis tool such as clang. 
2. 
3.
  
Actual results:


Expected results:
Avoid a dereference of a null pointer.


Additional info:

Comment 1 Alex Jia 2011-09-04 16:59:13 UTC
Patch for upstream and wait for developers review:
http://www.redhat.com/archives/libvir-list/2011-September/msg00265.html

Alex