vfs: fix pipe counter breakage
authorAl Viro <viro@ZenIV.linux.org.uk>
Tue, 12 Mar 2013 02:59:49 +0000 (02:59 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Mar 2013 18:32:06 +0000 (11:32 -0700)
commit542e9d5675e96e3affcac837b358b6dadebbbc37
tree6ad745c03b9dcedc8cf5b29c0acd93f4a38bf958
parent6e753e515f9ee87879a0630ba71366580dd0195f
vfs: fix pipe counter breakage

commit a930d8790552658140d7d0d2e316af4f0d76a512 upstream.

If you open a pipe for neither read nor write, the pipe code will not
add any usage counters to the pipe, causing the 'struct pipe_inode_info"
to be potentially released early.

That doesn't normally matter, since you cannot actually use the pipe,
but the pipe release code - particularly fasync handling - still expects
the actual pipe infrastructure to all be there.  And rather than adding
NULL pointer checks, let's just disallow this case, the same way we
already do for the named pipe ("fifo") case.

This is ancient going back to pre-2.4 days, and until trinity, nobody
naver noticed.

Reported-by: Dave Jones <davej@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/pipe.c