panic in sg_add when class_device_create() fails

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

 



We're seeing an occasional panic in sg_add() when class_device_create()
fails.  It's obvious in the code that it uses the pointer to sg_class_member
even though it's invalid.  We do see the "class_device_create failed" message.

        class_set_devdata(cl_dev, sdp);
        error = cdev_add(cdev, MKDEV(SCSI_GENERIC_MAJOR, sdp->index), 1);
        if (error)
                goto cdev_add_err;

        if (sg_sysfs_valid) {
                struct class_device * sg_class_member;

                sg_class_member = class_device_create(sg_sysfs_class, NULL,
                                MKDEV(SCSI_GENERIC_MAJOR, sdp->index),
                                cl_dev->dev, "%s",
                                disk->disk_name);
                if (IS_ERR(sg_class_member))
                        printk(KERN_WARNING "sg_add: "
                                "class_device_create failed\n");
                class_set_devdata(sg_class_member, sdp);
                                  ^^^^^^^^^^^^^^^^
                error = sysfs_create_link(&scsidp->sdev_gendev.kobj,
                                          &sg_class_member->kobj, "generic");
                if (error)
                        printk(KERN_ERR "sg_add: unable to make symlink "
                                        "'generic' back to sg%d\n", sdp->index);
        } else
                printk(KERN_WARNING "sg_add: sg_sys Invalid\n");

I'm uncertain of the correct fix.  Perhaps it involves a call to cdev_unmap()? 
I don't have a good way to test a fix as this problem is not easily reproduced.

Mike

-
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