Skip to contentSkip to conversation

block: do not leak info to user-space

PATCH New Cong Wang 1 participant 1 message May 10, 2013 Block layer

lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 block: do not leak info to user-space

From: Cong Wang <[email protected]>

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

---

block/compat_ioctl.c +1 -0
index 7c668c8..7e5d474 100644
@@ -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.