Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 285376
b: refs/heads/master
c: 806e23e
h: refs/heads/master
v: v3
  • Loading branch information
Haogang Chen authored and Mauro Carvalho Chehab committed Dec 11, 2011
1 parent fb871ff commit 1040e1f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 66847ef013cc4ed3ae519360e7e4cbf531465ae8
refs/heads/master: 806e23e95f94a27ee445022d724060b9b45cb64a
9 changes: 9 additions & 0 deletions trunk/drivers/media/video/uvc/uvc_v4l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ static int uvc_ioctl_ctrl_map(struct uvc_video_chain *chain,
break;

case V4L2_CTRL_TYPE_MENU:
/* Prevent excessive memory consumption, as well as integer
* overflows.
*/
if (xmap->menu_count == 0 ||
xmap->menu_count > UVC_MAX_CONTROL_MENU_ENTRIES) {
ret = -EINVAL;
goto done;
}

size = xmap->menu_count * sizeof(*map->menu_info);
map->menu_info = kmalloc(size, GFP_KERNEL);
if (map->menu_info == NULL) {
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/media/video/uvc/uvcvideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@

/* Maximum allowed number of control mappings per device */
#define UVC_MAX_CONTROL_MAPPINGS 1024
#define UVC_MAX_CONTROL_MENU_ENTRIES 32

/* Devices quirks */
#define UVC_QUIRK_STATUS_INTERVAL 0x00000001
Expand Down

0 comments on commit 1040e1f

Please sign in to comment.