[PATCH 2/8] Fixup initialisation oops for anonymous transport classes

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

 



Anonymous transport classes might call transport_add_class_devices
with NULL classdev.

Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
---
 drivers/base/transport_class.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/base/transport_class.c b/drivers/base/transport_class.c
index 72cf462..61a611c 100644
--- a/drivers/base/transport_class.c
+++ b/drivers/base/transport_class.c
@@ -150,10 +150,16 @@ static int transport_add_class_device(struct attribute_container *cont,
 				      struct device *dev,
 				      struct device *classdev)
 {
-	int error = attribute_container_add_class_device(classdev);
+	int error;
 	struct transport_container *tcont = 
 		attribute_container_to_transport_container(cont);
 
+	/* NULL if called from anonymous transport classes */
+	if (!classdev)
+		return 0;
+
+	error = attribute_container_add_class_device(classdev);
+
 	if (!error && tcont->statistics)
 		error = sysfs_create_group(&classdev->kobj, tcont->statistics);
 
-- 
1.5.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux