fuse: BUG_ON correction in fuse_dev_splice_write()
authorVasily Averin <vvs@virtuozzo.com>
Mon, 19 Aug 2019 06:53:50 +0000 (09:53 +0300)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 20 Apr 2020 15:01:34 +0000 (17:01 +0200)
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 <vvs@virtuozzo.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/dev.c

index 97eec7522bf203a929cefd7e0afd67fdd87cd7cb..5c155437a455d2ca2d925a17d00134ed8452213e 100644 (file)
@@ -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];