[Devel] [PATCH RHEL7 COMMIT] fuse: assert i_size boundaries for fuse_direct_IO_bvec

Konstantin Khorenko khorenko at virtuozzo.com
Mon Feb 19 14:02:59 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.17.1.vz7.45.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.17.1.vz7.43.7
------>
commit 40f49c93b1e1db2b4a1479fa6fc3aed49cd7b97c
Author: Dmitry Monakhov <dmonakhov at openvz.org>
Date:   Mon Feb 19 14:02:59 2018 +0300

    fuse: assert i_size boundaries for fuse_direct_IO_bvec
    
    Current implementation of fuse_direct_IO_bvec has not support
    to extend i_size, and this fact is silently ignored.
    Let's add explicit BUG_ON here.
    
    https://jira.sw.ru/browse/PSBM-80680
    Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 fs/fuse/file.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index d2911703051f..fe7e9d00ae8e 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -3447,8 +3447,12 @@ static ssize_t fuse_direct_IO_bvec(int rw, struct kiocb *iocb,
 	size_t nmax = (rw == WRITE ? fc->max_write : fc->max_read);
 	size_t filled, nres;
 	loff_t pos = iocb->ki_pos;
+	loff_t i_size = i_size_read(file->f_mapping->host);
 	int i;
 
+	/* TODO: File extension is not yet implemented */
+	BUG_ON(offset + bvec_length(bvec, bvec_len) > i_size);
+
 	if (nmax > FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT)
 		nmax = FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT;
 


More information about the Devel mailing list