ia64/linux-2.6.18-xen.hg

changeset 859:35b981251e10

linux/pci_back: fix NULL pointer ref.

pcistub_device_release() can be called during
initialization. Thus pci_get_drvdata() can return NULL.
Fix it by inserting NULL check.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Apr 14 11:16:08 2009 +0100 (2009-04-14)
parents e75edb8d2c44
children 3a8677ef8fd0
files drivers/xen/pciback/conf_space.c
line diff
     1.1 --- a/drivers/xen/pciback/conf_space.c	Tue Apr 14 14:05:30 2009 +0900
     1.2 +++ b/drivers/xen/pciback/conf_space.c	Tue Apr 14 11:16:08 2009 +0100
     1.3 @@ -297,6 +297,8 @@ void pciback_config_free_dyn_fields(stru
     1.4  
     1.5  	dev_dbg(&dev->dev,
     1.6  		"free-ing dynamically allocated virtual configuration space fields\n");
     1.7 +	if (!dev_data)
     1.8 +		return;
     1.9  
    1.10  	list_for_each_entry_safe(cfg_entry, t, &dev_data->config_fields, list) {
    1.11  		field = cfg_entry->field;
    1.12 @@ -321,6 +323,8 @@ void pciback_config_reset_dev(struct pci
    1.13  	const struct config_field *field;
    1.14  
    1.15  	dev_dbg(&dev->dev, "resetting virtual configuration space\n");
    1.16 +	if (!dev_data)
    1.17 +		return;
    1.18  
    1.19  	list_for_each_entry(cfg_entry, &dev_data->config_fields, list) {
    1.20  		field = cfg_entry->field;
    1.21 @@ -337,6 +341,8 @@ void pciback_config_free_dev(struct pci_
    1.22  	const struct config_field *field;
    1.23  
    1.24  	dev_dbg(&dev->dev, "free-ing virtual configuration space fields\n");
    1.25 +	if (!dev_data)
    1.26 +		return;
    1.27  
    1.28  	list_for_each_entry_safe(cfg_entry, t, &dev_data->config_fields, list) {
    1.29  		list_del(&cfg_entry->list);