aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasiliy Kulikov2010-11-08 07:42:40 -0600
committerJens Axboe2010-11-10 07:40:53 -0600
commita014741c0adfb8fb79952939ca087cf03d272bb9 (patch)
tree57bafa05736f172b94fde156bb51798b3ddb6107 /block/ioctl.c
parent77304d2abac6101f7249754ffdd4421258877ab0 (diff)
downloadkernel-common-a014741c0adfb8fb79952939ca087cf03d272bb9.tar.gz
kernel-common-a014741c0adfb8fb79952939ca087cf03d272bb9.tar.xz
kernel-common-a014741c0adfb8fb79952939ca087cf03d272bb9.zip
block: ioctl: fix information leak to userland
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>
Diffstat (limited to 'block/ioctl.c')
-rw-r--r--block/ioctl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index 38aa194f63e..3d866d0037f 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -242,6 +242,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
242 * We need to set the startsect first, the driver may 242 * We need to set the startsect first, the driver may
243 * want to override it. 243 * want to override it.
244 */ 244 */
245 memset(&geo, 0, sizeof(geo));
245 geo.start = get_start_sect(bdev); 246 geo.start = get_start_sect(bdev);
246 ret = disk->fops->getgeo(bdev, &geo); 247 ret = disk->fops->getgeo(bdev, &geo);
247 if (ret) 248 if (ret)