[Devel] [PATCH RHEL7 COMMIT] ms/fuse: break infinite loop in fuse_fill_write_pages()

Konstantin Khorenko khorenko at virtuozzo.com
Mon Oct 12 03:19:03 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.8.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.8.5
------>
commit 654ec46a26256b119505ba7dcc48e60c3c6a5cf5
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date:   Mon Oct 12 14:19:03 2015 +0400

    ms/fuse: break infinite loop in fuse_fill_write_pages()
    
    Backport bugfix from LKML. Original patch description:
    
    I got a report about unkillable task eating CPU. Thge further
    investigation shows, that the problem is in the fuse_fill_write_pages()
    function. If iov's first segment has zero length, we get an infinite
    loop, because we never reach iov_iter_advance() call.
    
    Fix this by calling iov_iter_advance() before repeating an attempt to
    copy data from userspace.
    
    A similar problem is described in 124d3b7041f ("fix writev regression:
    pan hanging unkillable and un-straceable").
    
    Signed-off-by: Roman Gushchin <klamm at yandex-team.ru>
    Cc: Miklos Szeredi <miklos at szeredi.hu>
    
    Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
    Acked-by: Dmitry Monakhov <dmonakhov at virtuozzo.com>
---
 fs/fuse/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a5c4125..88e6e46 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1327,6 +1327,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req,
 
 		mark_page_accessed(page);
 
+		iov_iter_advance(ii, tmp);
 		if (!tmp) {
 			unlock_page(page);
 			page_cache_release(page);
@@ -1339,7 +1340,6 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req,
 		req->page_descs[req->num_pages].length = tmp;
 		req->num_pages++;
 
-		iov_iter_advance(ii, tmp);
 		count += tmp;
 		pos += tmp;
 		offset += tmp;



More information about the Devel mailing list