If the call is done too early, hald will query the dri_library_name
and cause a NULL pointer dereference.

Signed-off-by: Steven Noonan <[email protected]>
---
 linux-core/drm_stub.c |   20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/linux-core/drm_stub.c b/linux-core/drm_stub.c
index 6e68f67..d54cd9f 100644
--- a/linux-core/drm_stub.c
+++ b/linux-core/drm_stub.c
@@ -218,24 +218,11 @@ static int drm_get_minor(struct drm_device *dev, struct 
drm_minor **minor, int t
        } else
                new_minor->dev_root = NULL;
 
-       ret = drm_sysfs_device_add(new_minor);
-       if (ret) {
-               printk(KERN_ERR
-                      "DRM: Error sysfs_device_add.\n");
-               goto err_g2;
-       }
        *minor = new_minor;
        
        DRM_DEBUG("new minor assigned %d\n", minor_id);
        return 0;
 
-
-err_g2:
-       if (new_minor->type == DRM_MINOR_LEGACY) {
-               if (dev->driver->proc_cleanup)
-                       dev->driver->proc_cleanup(new_minor);
-               drm_proc_cleanup(new_minor, drm_proc_root);
-       }
 err_mem:
        kfree(new_minor);
 err_idr:
@@ -292,6 +279,13 @@ int drm_get_dev(struct pci_dev *pdev, const struct 
pci_device_id *ent,
                if ((ret = dev->driver->load(dev, ent->driver_data)))
                        goto err_g4;
 
+       ret = drm_sysfs_device_add(dev->primary);
+       if (ret) {
+               printk(KERN_ERR
+                      "DRM: Error sysfs_device_add.\n");
+               goto err_g4;
+       }
+
        DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
                 driver->name, driver->major, driver->minor, driver->patchlevel,
                 driver->date, dev->primary->index);
-- 
1.6.3.3


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to