From: David Howells Date: Fri, 6 Dec 2019 21:34:51 +0000 (+0000) Subject: pipe: Fix iteration end check in fuse_dev_splice_write() X-Git-Tag: microblaze-v5.6-rc1~30 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=76f6777c9cc04efe8036b1d2aa76e618c1631cc6;hp=43a2898631a8beee66c1d64c1e860f43d96b2e91;p=linux-2.6-microblaze.git pipe: Fix iteration end check in fuse_dev_splice_write() 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: 8cefc107ca54 ("pipe: Use head and tail pointers for the ring, not cursor and length") Reported-by: Linus Torvalds Signed-off-by: David Howells Signed-off-by: Linus Torvalds --- diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index d4e6691d2d92..8e02d76fe104 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -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;