diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2018-06-09 09:43:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-25 11:25:11 +0200 |
commit | ea8a50e5f829ad3e855f45b29e96612a92bb1418 (patch) | |
tree | 7d7e649c82ad76400f544f21d8841972724e79a9 | |
parent | b12c7d0847e224301fb2323b5a85d866ead87199 (diff) |
cxl_getfile(): fix double-iput() on alloc_file() failures
commit d202797f480c0e5918e7642d6716cdc62b3ab5c9 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/misc/cxl/api.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c index a0c44d16bf30..c75daba57fd7 100644 --- a/drivers/misc/cxl/api.c +++ b/drivers/misc/cxl/api.c @@ -102,15 +102,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: |