All of lore.kernel.org
 help / color / mirror / Atom feed
* scsi: osst: drop SCSI devie reference taken before
@ 2019-04-17  7:40 Pan Bian
  0 siblings, 0 replies; only message in thread
From: Pan Bian @ 2019-04-17  7:40 UTC (permalink / raw)
  To: Willem Riede, James E.J. Bottomley, Martin K. Petersen
  Cc: osst-users, linux-scsi, linux-kernel, Pan Bian

In the function __os_scsi_tape_open, scsi_device_get is called to take a
reference of the device. The reference should be dropped when it is no
longer used. However, when scsi_block_when_processing_errors returns a
false value, the reference is not dropped. This patch fixes the bug.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/scsi/osst.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index be3c73e..f2b2b86 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -4489,7 +4489,8 @@ static int __os_scsi_tape_open(struct inode * inode, struct file * filp)
 	STp->rew_at_close = TAPE_REWIND(inode);
 
 	if( !scsi_block_when_processing_errors(STp->device) ) {
-		return -ENXIO;
+		retval = -ENXIO;
+		goto err_out;
 	}
 
 	if (mode != STp->current_mode) {
-- 
2.7.4



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-17  7:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-17  7:40 scsi: osst: drop SCSI devie reference taken before Pan Bian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.