Skip to content

Commit

Permalink
ocxlflash_getfile(): fix double-iput() on alloc_file() failures
Browse files Browse the repository at this point in the history
Cc: stable@vger.kernel.org
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jul 11, 2018
1 parent d202797 commit c7e9075
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/scsi/cxlflash/ocxl_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c7e9075

Please sign in to comment.