Skip to content
Permalink
Browse files Browse the repository at this point in the history
[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 <dan.carpenter@oracle.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Dan Carpenter authored and Mauro Carvalho Chehab committed Jun 12, 2013
1 parent fe905b8 commit c88e739
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/media/media-device.c
Expand Up @@ -142,6 +142,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;
Expand All @@ -159,6 +161,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,
Expand Down

0 comments on commit c88e739

Please sign in to comment.