From ac221d35f8638f395cef50519d5c8057e03343b5 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sat, 13 Apr 2013 06:32:15 -0300 Subject: [PATCH] upstream: [media] media: info leak in __media_device_enum_links() These structs have holes and reserved struct members which aren't cleared. I've added a memset() so we don't leak stack information. Signed-off-by: Dan Carpenter Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/media-device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index fdb5840..88c1606 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -141,6 +141,8 @@ static long __media_device_enum_links(struct media_device *mdev, for (p = 0; p < entity->num_pads; p++) { struct media_pad_desc pad; + + memset(&pad, 0, sizeof(pad)); media_device_kpad_to_upad(&entity->pads[p], &pad); if (copy_to_user(&links->pads[p], &pad, sizeof(pad))) return -EFAULT; @@ -158,6 +160,7 @@ static long __media_device_enum_links(struct media_device *mdev, if (entity->links[l].source->entity != entity) continue; + memset(&link, 0, sizeof(link)); media_device_kpad_to_upad(entity->links[l].source, &link.source); media_device_kpad_to_upad(entity->links[l].sink, -- 2.7.4