]> Git Repo - linux.git/commitdiff
block: ioctl: fix information leak to userland
authorVasiliy Kulikov <[email protected]>
Mon, 8 Nov 2010 13:42:40 +0000 (14:42 +0100)
committerJens Axboe <[email protected]>
Wed, 10 Nov 2010 13:40:53 +0000 (14:40 +0100)
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 <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
block/ioctl.c

index 38aa194f63ec235f10e76159faf06cb183486d1f..3d866d0037f240c8d636f8b8523df962e72ab123 100644 (file)
@@ -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)
This page took 0.050546 seconds and 4 git commands to generate.