From: Vasily Averin <vvs@virtuozzo.com>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Miklos Szeredi <miklos@szeredi.hu>,
Andrey Ryabinin <aryabinin@virtuozzo.com>
Subject: [PATCH] fuse: BUG_ON correction in fuse_dev_splice_write()
Date: Mon, 19 Aug 2019 09:53:50 +0300 [thread overview]
Message-ID: <1b09a159-bcec-63c9-df42-47d99f44d445@virtuozzo.com> (raw)
In-Reply-To: <CAJfpegv-EQhvJUB0AUhJ=Xx8moHHQvkDGe-yUXHENyWvboBU3A@mail.gmail.com>
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.
Fixes: 963545357202 ("fuse: reduce allocation size for splice_write")
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
fs/fuse/dev.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index ea8237513dfa..f4ef6e01642c 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -2029,7 +2029,7 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,
struct file *out, loff_t *ppos,
size_t len, unsigned int flags)
{
- unsigned nbuf;
+ unsigned nbuf, bsize;
unsigned idx;
struct pipe_buffer *bufs;
struct fuse_copy_state cs;
@@ -2043,7 +2043,8 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,
pipe_lock(pipe);
- bufs = kvmalloc_array(pipe->nrbufs, sizeof(struct pipe_buffer),
+ bsize = pipe->nrbufs;
+ bufs = kvmalloc_array(bsize, sizeof(struct pipe_buffer),
GFP_KERNEL);
if (!bufs) {
pipe_unlock(pipe);
@@ -2064,7 +2065,7 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,
struct pipe_buffer *ibuf;
struct pipe_buffer *obuf;
- BUG_ON(nbuf >= pipe->buffers);
+ BUG_ON(nbuf >= bsize);
BUG_ON(!pipe->nrbufs);
ibuf = &pipe->bufs[pipe->curbuf];
obuf = &bufs[nbuf];
--
2.17.1
next prev parent reply other threads:[~2019-08-19 6:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-23 6:33 [PATCH] fuse: BUG_ON's correction in fuse_dev_splice_write() Vasily Averin
2019-08-01 11:01 ` Miklos Szeredi
2019-08-19 6:52 ` Vasily Averin
2019-08-19 6:53 ` Vasily Averin [this message]
2019-10-03 8:04 ` [PATCH] fuse: BUG_ON " Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1b09a159-bcec-63c9-df42-47d99f44d445@virtuozzo.com \
--to=vvs@virtuozzo.com \
--cc=aryabinin@virtuozzo.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).