[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180709045417.13988-2-viro@ZenIV.linux.org.uk>
Date: Mon, 9 Jul 2018 05:53:52 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...nel.org
Subject: [RFC][PATCH 02/27] cxl_getfile(): fix double-iput() on alloc_file() failures
From: Al Viro <viro@...iv.linux.org.uk>
Doing iput() after path_put() is wrong.
Cc: stable@...nel.org
Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
drivers/misc/cxl/api.c | 8 ++++----
1 file 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:
--
2.11.0
Powered by blists - more mailing lists