All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pipe: Fix iteration end check in fuse_dev_splice_write()
@ 2019-12-06 21:34 David Howells
  2019-12-07 18:29 ` Mariusz Ceier
  0 siblings, 1 reply; 4+ messages in thread
From: David Howells @ 2019-12-06 21:34 UTC (permalink / raw)
  To: torvalds; +Cc: miklos, dhowells, viro, linux-fsdevel, linux-kernel

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 <torvalds@linux-foundation.org>
Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/fuse/dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-07 19:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06 21:34 [PATCH] pipe: Fix iteration end check in fuse_dev_splice_write() David Howells
2019-12-07 18:29 ` Mariusz Ceier
2019-12-07 18:55   ` Linus Torvalds
2019-12-07 19:33     ` Mariusz Ceier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.