[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] linux/pci_back: fix NULL pointer ref.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1239704168 -3600
# Node ID 35b981251e102e114f2a0731a03e697d5a16b8d1
# Parent  e75edb8d2c441434b03d098873d0bb7d0b029c1c
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@xxxxxxxxxxxxx>
---
 drivers/xen/pciback/conf_space.c |    6 ++++++
 1 files changed, 6 insertions(+)

diff -r e75edb8d2c44 -r 35b981251e10 drivers/xen/pciback/conf_space.c
--- a/drivers/xen/pciback/conf_space.c  Tue Apr 14 14:05:30 2009 +0900
+++ b/drivers/xen/pciback/conf_space.c  Tue Apr 14 11:16:08 2009 +0100
@@ -297,6 +297,8 @@ void pciback_config_free_dyn_fields(stru
 
        dev_dbg(&dev->dev,
                "free-ing dynamically allocated virtual configuration space 
fields\n");
+       if (!dev_data)
+               return;
 
        list_for_each_entry_safe(cfg_entry, t, &dev_data->config_fields, list) {
                field = cfg_entry->field;
@@ -321,6 +323,8 @@ void pciback_config_reset_dev(struct pci
        const struct config_field *field;
 
        dev_dbg(&dev->dev, "resetting virtual configuration space\n");
+       if (!dev_data)
+               return;
 
        list_for_each_entry(cfg_entry, &dev_data->config_fields, list) {
                field = cfg_entry->field;
@@ -337,6 +341,8 @@ void pciback_config_free_dev(struct pci_
        const struct config_field *field;
 
        dev_dbg(&dev->dev, "free-ing virtual configuration space fields\n");
+       if (!dev_data)
+               return;
 
        list_for_each_entry_safe(cfg_entry, t, &dev_data->config_fields, list) {
                list_del(&cfg_entry->list);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.