Skip to content

Commit

Permalink
[SCSI] osduld: Ref-counting bug fix
Browse files Browse the repository at this point in the history
If scsi has released the device (logout), and exofs has last
reference on the osduld_device it will be freed by
osd_uld_release() within the call to fput(). But this will
oops in cdev_release() which is called after the fops->release.
(cdev is embedded within osduld_device). __uld_get/put pair
makes sure we have a cdev for the duration of fput()

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Boaz Harrosh authored and James Bottomley committed Dec 4, 2009
1 parent c7d2dc2 commit 89f5e1f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/scsi/osd/osd_uld.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,15 @@ void osduld_put_device(struct osd_dev *od)

BUG_ON(od->scsi_device != oud->od.scsi_device);

/* If scsi has released the device (logout), and exofs has last
* reference on oud it will be freed by above osd_uld_release
* within fput below. But this will oops in cdev_release which
* is called after the fops->release. __uld_get/put pair makes
* sure we have a cdev for the duration of fput
*/
__uld_get(oud);
fput(od->file);
__uld_put(oud);
kfree(od);
}
}
Expand Down

0 comments on commit 89f5e1f

Please sign in to comment.