Commit ea8a50e5 authored by Al Viro's avatar Al Viro Committed by Greg Kroah-Hartman

cxl_getfile(): fix double-iput() on alloc_file() failures

commit d202797f upstream.

Doing iput() after path_put() is wrong.

Cc: stable@vger.kernel.org
Acked-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b12c7d08
...@@ -102,15 +102,15 @@ static struct file *cxl_getfile(const char *name, ...@@ -102,15 +102,15 @@ static struct file *cxl_getfile(const char *name,
d_instantiate(path.dentry, inode); d_instantiate(path.dentry, inode);
file = alloc_file(&path, OPEN_FMODE(flags), fops); file = alloc_file(&path, OPEN_FMODE(flags), fops);
if (IS_ERR(file)) if (IS_ERR(file)) {
goto err_dput; path_put(&path);
goto err_fs;
}
file->f_flags = flags & (O_ACCMODE | O_NONBLOCK); file->f_flags = flags & (O_ACCMODE | O_NONBLOCK);
file->private_data = priv; file->private_data = priv;
return file; return file;
err_dput:
path_put(&path);
err_inode: err_inode:
iput(inode); iput(inode);
err_fs: err_fs:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment