summary refs log tree commit diff
path: root/drivers/scsi/cxlflash
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-06-17 12:38:17 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-07-10 23:29:03 -0400
commitc7e9075fb89362812059fbf8e25bb4a6e825c4c5 (patch)
treed76a2d30bc823ac9dd75a6fa4ad2077d3ff5f2f6 /drivers/scsi/cxlflash
parentd202797f480c0e5918e7642d6716cdc62b3ab5c9 (diff)
downloadlinux-c7e9075fb89362812059fbf8e25bb4a6e825c4c5.tar.gz
ocxlflash_getfile(): fix double-iput() on alloc_file() failures
Cc: stable@vger.kernel.org
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/scsi/cxlflash')
-rw-r--r--drivers/scsi/cxlflash/ocxl_hw.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 0a95b5f25380..497a68389461 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -134,15 +134,14 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
 		rc = PTR_ERR(file);
 		dev_err(dev, "%s: alloc_file failed rc=%d\n",
 			__func__, rc);
-		goto err5;
+		path_put(&path);
+		goto err3;
 	}
 
 	file->f_flags = flags & (O_ACCMODE | O_NONBLOCK);
 	file->private_data = priv;
 out:
 	return file;
-err5:
-	path_put(&path);
 err4:
 	iput(inode);
 err3: