Message ID | 1503580432-105307-1-git-send-email-hare@suse.de (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Hannes, > Currently we free the resources backing the enclosure device before we > call device_unregister(). This is racy: during rmmod of low-level SCSI > drivers that hook into enclosure, we end up with a small window of > time during which writing to /sys can OOPS. Example trace with > mpt3sas: Applied to 4.14/scsi-queue but dropped link to non-public bugzilla.
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index a3f9350..ea7066c 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -818,8 +818,6 @@ static void ses_intf_remove_enclosure(struct scsi_device *sdev) if (!edev) return; - enclosure_unregister(edev); - ses_dev = edev->scratch; edev->scratch = NULL; @@ -831,6 +829,7 @@ static void ses_intf_remove_enclosure(struct scsi_device *sdev) kfree(edev->component[0].scratch); put_device(&edev->edev); + enclosure_unregister(edev); } static void ses_intf_remove(struct device *cdev,