linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch] block: do not leak info to user-space
@ 2013-05-10  9:06 Cong Wang
  0 siblings, 0 replies; only message in thread
From: Cong Wang @ 2013-05-10  9:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Jens Axboe, Cong Wang

From: Cong Wang <amwang@redhat.com>

There is a hole in struct hd_geometry, so we have to
zero the struct on stack before copying it to user-space.

Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Cong Wang <amwang@redhat.com>

---
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
index 7c668c8..7e5d474 100644
--- a/block/compat_ioctl.c
+++ b/block/compat_ioctl.c
@@ -59,6 +59,7 @@ static int compat_hdio_getgeo(struct gendisk *disk, struct block_device *bdev,
 	if (!disk->fops->getgeo)
 		return -ENOTTY;
 
+	memset(&geo, 0, sizeof(geo));
 	/*
 	 * We need to set the startsect first, the driver may
 	 * want to override it.

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-05-10  9:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-10  9:06 [Patch] block: do not leak info to user-space Cong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).