Skip to content

Commit

Permalink
cxl_getfile(): fix double-iput() on alloc_file() failures
Browse files Browse the repository at this point in the history
Doing iput() after path_put() is wrong.

Cc: [email protected]
Acked-by: Linus Torvalds <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Jul 11, 2018
1 parent b4e7a7a commit d202797
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/misc/cxl/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d202797

Please sign in to comment.