diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2018-07-09 02:29:58 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2018-07-10 23:29:03 -0400 |
commit | b10a4a9f7695335bd2bb19bffdda7fbefbc6581f (patch) | |
tree | da3e64cb16b4f34bcc25b2155406d31720b5a611 | |
parent | 19f391eb05b8b005f2907ddc8f284487b446abf3 (diff) |
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: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/pipe.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -771,8 +771,9 @@ int create_pipe_files(struct file **res, int flags) | |||
771 | 771 | ||
772 | res[0] = alloc_file(&path, FMODE_READ, &pipefifo_fops); | 772 | res[0] = alloc_file(&path, FMODE_READ, &pipefifo_fops); |
773 | if (IS_ERR(res[0])) { | 773 | if (IS_ERR(res[0])) { |
774 | err = PTR_ERR(res[0]); | 774 | put_pipe_info(inode, inode->i_pipe); |
775 | goto err_file; | 775 | fput(f); |
776 | return PTR_ERR(res[0]); | ||
776 | } | 777 | } |
777 | 778 | ||
778 | path_get(&path); | 779 | path_get(&path); |
@@ -781,8 +782,6 @@ int create_pipe_files(struct file **res, int flags) | |||
781 | res[1] = f; | 782 | res[1] = f; |
782 | return 0; | 783 | return 0; |
783 | 784 | ||
784 | err_file: | ||
785 | put_filp(f); | ||
786 | err_dentry: | 785 | err_dentry: |
787 | free_pipe_info(inode->i_pipe); | 786 | free_pipe_info(inode->i_pipe); |
788 | path_put(&path); | 787 | path_put(&path); |