]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - lib/kobject_uevent.c
driver core: fix namespace issue with devices assigned to classes
[mirror_ubuntu-artful-kernel.git] / lib / kobject_uevent.c
index 84272ed77f039c55de62be540ac19d23189cc06f..4122f38330d48557111c7cdc7f10ab8161623322 100644 (file)
@@ -115,6 +115,16 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
                        return 0;
                }
 
+       /* originating subsystem */
+       if (uevent_ops && uevent_ops->name)
+               subsystem = uevent_ops->name(kset, kobj);
+       else
+               subsystem = kobject_name(&kset->kobj);
+       if (!subsystem) {
+               pr_debug("unset subsytem caused the event to drop!\n");
+               return 0;
+       }
+
        /* environment index */
        envp = kzalloc(NUM_ENVP * sizeof (char *), GFP_KERNEL);
        if (!envp)
@@ -134,12 +144,6 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
                goto exit;
        }
 
-       /* originating subsystem */
-       if (uevent_ops && uevent_ops->name)
-               subsystem = uevent_ops->name(kset, kobj);
-       else
-               subsystem = kobject_name(&kset->kobj);
-
        /* event environemnt for helper process only */
        envp[i++] = "HOME=/";
        envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
@@ -293,7 +297,7 @@ EXPORT_SYMBOL_GPL(add_uevent_var);
 static int __init kobject_uevent_init(void)
 {
        uevent_sock = netlink_kernel_create(NETLINK_KOBJECT_UEVENT, 1, NULL,
-                                           THIS_MODULE);
+                                           NULL, THIS_MODULE);
 
        if (!uevent_sock) {
                printk(KERN_ERR