aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2011-11-16 03:21:48 -0500
committerJens Axboe <axboe@kernel.dk>2011-11-16 03:21:48 -0500
commit3bb9068278ea524581237abadd41377a14717e7d (patch)
tree6e360ae87c4b393e862b6bb2ab18e8f2cea22797 /drivers/block
parent6b76106d8ef31111d6fc469564b83b5f5542794f (diff)
loop: prevent information leak after failed read
If read was not fully successful we have to fail whole bio to prevent information leak of old pages ##Testcase_begin dd if=/dev/zero of=./file bs=1M count=1 losetup /dev/loop0 ./file -o 4096 truncate -s 0 ./file # OOps loop offset is now beyond i_size, so read will silently fail. # So bio's pages would not be cleared, may which result in information leak. hexdump -C /dev/loop0 ##testcase_end Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/loop.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 3d806820280e..0d567397c254 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -372,7 +372,8 @@ do_lo_receive(struct loop_device *lo,
372 372
373 if (retval < 0) 373 if (retval < 0)
374 return retval; 374 return retval;
375 375 if (retval != bvec->bv_len)
376 return -EIO;
376 return 0; 377 return 0;
377} 378}
378 379