Skip to content

Commit

Permalink
loop: prevent information leak after failed read
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dmitry Monakhov authored and Jens Axboe committed Nov 16, 2011
1 parent 6b76106 commit 3bb9068
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ do_lo_receive(struct loop_device *lo,

if (retval < 0)
return retval;

if (retval != bvec->bv_len)
return -EIO;
return 0;
}

Expand Down

0 comments on commit 3bb9068

Please sign in to comment.