summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-06-09 15:43:13 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2018-07-11 05:29:03 +0200
commitd202797f480c0e5918e7642d6716cdc62b3ab5c9 (patch)
tree0335b6af48f3ea299d82567686316f7d081944c3
parentdrm_mode_create_lease_ioctl(): fix open-coded filp_clone_open() (diff)
downloadlinux-d202797f480c0e5918e7642d6716cdc62b3ab5c9.tar.xz
linux-d202797f480c0e5918e7642d6716cdc62b3ab5c9.zip
cxl_getfile(): fix double-iput() on alloc_file() failures
Doing iput() after path_put() is wrong. Cc: stable@vger.kernel.org Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--drivers/misc/cxl/api.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 753b1a698fc4..6b16946f9b05 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -103,15 +103,15 @@ static struct file *cxl_getfile(const char *name,
d_instantiate(path.dentry, inode);
file = alloc_file(&path, OPEN_FMODE(flags), fops);
- if (IS_ERR(file))
- goto err_dput;
+ if (IS_ERR(file)) {
+ path_put(&path);
+ goto err_fs;
+ }
file->f_flags = flags & (O_ACCMODE | O_NONBLOCK);
file->private_data = priv;
return file;
-err_dput:
- path_put(&path);
err_inode:
iput(inode);
err_fs: