Skip to content

Commit

Permalink
block: ioctl: fix information leak to userland
Browse files Browse the repository at this point in the history
Structure hd_geometry is copied to userland with 4 padding bytes
between cylinders and start fields uninitialized on 64-bit platforms.
It leads to leaking of contents of kernel stack memory.

Currently there is no memset() in real implementations of getgeo()
in drivers/block/, so it makes sense to have memset() in blkdev_ioctl().

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
  • Loading branch information
Vasiliy Kulikov authored and Jens Axboe committed Nov 10, 2010
1 parent 77304d2 commit a014741
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions block/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
* We need to set the startsect first, the driver may
* want to override it.
*/
memset(&geo, 0, sizeof(geo));
geo.start = get_start_sect(bdev);
ret = disk->fops->getgeo(bdev, &geo);
if (ret)
Expand Down

0 comments on commit a014741

Please sign in to comment.