Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b10a4a9f authored by Al Viro's avatar Al Viro
Browse files

create_pipe_files(): use fput() if allocation of the second file fails



... just use put_pipe_info() to get the pipe->files down to 1 and let
fput()-called pipe_release() do freeing.

Acked-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 19f391eb
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -771,8 +771,9 @@ int create_pipe_files(struct file **res, int flags)

	res[0] = alloc_file(&path, FMODE_READ, &pipefifo_fops);
	if (IS_ERR(res[0])) {
		err = PTR_ERR(res[0]);
		goto err_file;
		put_pipe_info(inode, inode->i_pipe);
		fput(f);
		return PTR_ERR(res[0]);
	}

	path_get(&path);
@@ -781,8 +782,6 @@ int create_pipe_files(struct file **res, int flags)
	res[1] = f;
	return 0;

err_file:
	put_filp(f);
err_dentry:
	free_pipe_info(inode->i_pipe);
	path_put(&path);