linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: break infinite loop in fuse_fill_write_pages()
@ 2015-09-21 10:02 Roman Gushchin
  2015-10-02 11:21 ` Konstantin Khlebnikov
  0 siblings, 1 reply; 8+ messages in thread
From: Roman Gushchin @ 2015-09-21 10:02 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-kernel, fuse-devel, Roman Gushchin

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@yandex-team.ru>
Cc: Miklos Szeredi <miklos@szeredi.hu>
---
 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 f523f2f..195476a 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1049,6 +1049,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req,
 		tmp = iov_iter_copy_from_user_atomic(page, ii, offset, bytes);
 		flush_dcache_page(page);
 
+		iov_iter_advance(ii, tmp);
 		if (!tmp) {
 			unlock_page(page);
 			page_cache_release(page);
@@ -1061,7 +1062,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;
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-11-10 14:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-21 10:02 [PATCH] fuse: break infinite loop in fuse_fill_write_pages() Roman Gushchin
2015-10-02 11:21 ` Konstantin Khlebnikov
2015-10-02 19:27   ` [fuse-devel] " Maxim Patlasov
2015-10-02 22:04     ` Andrew Morton
2015-10-03  1:58       ` Konstantin Khlebnikov
2015-10-05 18:37         ` Maxim Patlasov
2015-10-12 13:33           ` [PATCH v2] " Roman Gushchin
2015-11-10 14:41             ` Miklos Szeredi

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).