Commit 26c19d4d authored by James Bottomley's avatar James Bottomley

fix use after potential free in scsi_cd_put

kref_put could free the cd structure.  We need a copy
of cd->device to do a scsi_device_put after the
kref_put.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent aa545c84
......@@ -152,9 +152,11 @@ static inline struct scsi_cd *scsi_cd_get(struct gendisk *disk)
static inline void scsi_cd_put(struct scsi_cd *cd)
{
struct scsi_device *sdev = cd->device;
down(&sr_ref_sem);
kref_put(&cd->kref, sr_kref_release);
scsi_device_put(cd->device);
scsi_device_put(sdev);
up(&sr_ref_sem);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment