]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
fs/pipe: allow sendfile() to pipe again
authorJohannes Berg <johannes@sipsolutions.net>
Mon, 25 Jan 2021 09:16:15 +0000 (10:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Jan 2021 10:55:29 +0000 (11:55 +0100)
commite8572713897eb9e4bfaef90bf15d5dd00d7126fc
tree724683ec9884ebc98de4bd736603c4b405d3d369
parenteb5381efaf367e7976c9f337a507f7529f964917
fs/pipe: allow sendfile() to pipe again

commit f8ad8187c3b536ee2b10502a8340c014204a1af0 upstream.

After commit 36e2c7421f02 ("fs: don't allow splice read/write
without explicit ops") sendfile() could no longer send data
from a real file to a pipe, breaking for example certain cgit
setups (e.g. when running behind fcgiwrap), because in this
case cgit will try to do exactly this: sendfile() to a pipe.

Fix this by using iter_file_splice_write for the splice_write
method of pipes, as suggested by Christoph.

Cc: stable@vger.kernel.org
Fixes: 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops")
Suggested-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/pipe.c