aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily Averin <[email protected]>2019-08-19 09:53:50 +0300
committerMiklos Szeredi <[email protected]>2020-04-20 17:01:34 +0200
commit0e9fb6f17ad5b386b75451328975a07d7d953c6d (patch)
tree06bbac19b2f8577bd738734cd63d49e255e8e2cb
parenta5d8422cc9598b11054faf34772d9ce68ae204fd (diff)
fuse: BUG_ON correction in fuse_dev_splice_write()
commit 963545357202 ("fuse: reduce allocation size for splice_write") changed size of bufs array, so BUG_ON which checks the index of the array shold also be fixed. [SzM: turn BUG_ON into WARN_ON] Fixes: 963545357202 ("fuse: reduce allocation size for splice_write") Signed-off-by: Vasily Averin <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]>
-rw-r--r--fs/fuse/dev.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 97eec7522bf2..5c155437a455 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1977,8 +1977,9 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,
struct pipe_buffer *ibuf;
struct pipe_buffer *obuf;
- BUG_ON(nbuf >= pipe->ring_size);
- BUG_ON(tail == head);
+ if (WARN_ON(nbuf >= count || tail == head))
+ goto out_free;
+
ibuf = &pipe->bufs[tail & mask];
obuf = &bufs[nbuf];