Skip to content

Commit

Permalink
pipe: Fix iteration end check in fuse_dev_splice_write()
Browse files Browse the repository at this point in the history
Fix the iteration end check in fuse_dev_splice_write().  The iterator
position can only be compared with == or != since wrappage may be involved.

Fixes: 8cefc10 ("pipe: Use head and tail pointers for the ring, not cursor and length")
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Howells authored and Linus Torvalds committed Dec 6, 2019
1 parent 43a2898 commit 76f6777
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/fuse/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1965,7 +1965,7 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,

nbuf = 0;
rem = 0;
for (idx = tail; idx < head && rem < len; idx++)
for (idx = tail; idx != head && rem < len; idx++)
rem += pipe->bufs[idx & mask].len;

ret = -EINVAL;
Expand Down

0 comments on commit 76f6777

Please sign in to comment.