Skip to content

Commit d202797

Browse files
author
Al Viro
committed
cxl_getfile(): fix double-iput() on alloc_file() failures
Doing iput() after path_put() is wrong. Cc: [email protected] Acked-by: Linus Torvalds <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent b4e7a7a commit d202797

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/misc/cxl/api.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ static struct file *cxl_getfile(const char *name,
103103
d_instantiate(path.dentry, inode);
104104

105105
file = alloc_file(&path, OPEN_FMODE(flags), fops);
106-
if (IS_ERR(file))
107-
goto err_dput;
106+
if (IS_ERR(file)) {
107+
path_put(&path);
108+
goto err_fs;
109+
}
108110
file->f_flags = flags & (O_ACCMODE | O_NONBLOCK);
109111
file->private_data = priv;
110112

111113
return file;
112114

113-
err_dput:
114-
path_put(&path);
115115
err_inode:
116116
iput(inode);
117117
err_fs:

0 commit comments

Comments
 (0)