Skip to content

Commit

Permalink
fs/pipe: allow sendfile() to pipe again
Browse files Browse the repository at this point in the history
After commit 36e2c74 ("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: 36e2c74 ("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>
  • Loading branch information
Johannes Berg authored and Linus Torvalds committed Jan 25, 2021
1 parent 9f12e37 commit f8ad818
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,7 @@ const struct file_operations pipefifo_fops = {
.unlocked_ioctl = pipe_ioctl,
.release = pipe_release,
.fasync = pipe_fasync,
.splice_write = iter_file_splice_write,
};

/*
Expand Down

0 comments on commit f8ad818

Please sign in to comment.