aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2015-02-10 17:09:29 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-10 17:30:30 -0500
commit913e027ca17ee06fa9436a21e54464795b0fa0e8 (patch)
treed583200d611573204224ac54bb7f7f1a633950ef /fs
parent99b8874e79619498ade354357f64299768642af6 (diff)
fsioctl.c: make generic_block_fiemap() signal-tolerant
__generic_block_fiemap may spin very long time for large sparse files. Without this patch an unprivileged user may abuse system resources simply by spawning a vast number of unkilable busyloops (works on ext2/ext3): truncate --size 1T test for ((i=0;i<1024;i++)) do filefrag test > /dev/null & done Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Cc: Theodore Ts'o <tytso@mit.edu> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ioctl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 214c3c11fbc2..5d01d2638ca5 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -379,6 +379,11 @@ int __generic_block_fiemap(struct inode *inode,
379 past_eof = true; 379 past_eof = true;
380 } 380 }
381 cond_resched(); 381 cond_resched();
382 if (fatal_signal_pending(current)) {
383 ret = -EINTR;
384 break;
385 }
386
382 } while (1); 387 } while (1);
383 388
384 /* If ret is 1 then we just hit the end of the extent array */ 389 /* If ret is 1 then we just hit the end of the extent array */