[PATCH] fix leaks on pipe(2) failure exits
authorAl Viro <viro@ftp.linux.org.uk>
Mon, 18 Dec 2006 13:31:18 +0000 (13:31 +0000)
committerLinus Torvalds <torvalds@woody.osdl.org>
Thu, 21 Dec 2006 08:16:03 +0000 (00:16 -0800)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/pipe.c

index 9a06e8e48e8dfb366a8c08bd387985788391a5d8..68090e84f589305ebe80ee57e723c86494ca6143 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -935,8 +935,9 @@ struct file *create_write_pipe(void)
 
 void free_write_pipe(struct file *f)
 {
-       mntput(f->f_path.mnt);
+       free_pipe_info(f->f_dentry->d_inode);
        dput(f->f_path.dentry);
+       mntput(f->f_path.mnt);
        put_filp(f);
 }
 
@@ -994,6 +995,8 @@ int do_pipe(int *fd)
  err_fdr:
        put_unused_fd(fdr);
  err_read_pipe:
+       dput(fr->f_dentry);
+       mntput(fr->f_vfsmnt);
        put_filp(fr);
  err_write_pipe:
        free_write_pipe(fw);