diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2018-04-11 18:47:32 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2018-04-17 12:50:00 +0300 |
commit | ea72fbf588ac9c017224dcdaa2019ff52ca56fee (patch) | |
tree | 42295573e6220f1db1517775ee352abf81de5b6c /drivers | |
parent | 34b2ea1c9e6a6bc5cb57e447dda4196d46da69e8 (diff) | |
download | linux-ea72fbf588ac9c017224dcdaa2019ff52ca56fee.tar.xz |
media: v4l2-compat-ioctl32: prevent go past max size
As warned by smatch:
drivers/media/v4l2-core/v4l2-compat-ioctl32.c:879 put_v4l2_ext_controls32() warn: check for integer overflow 'count'
The access_ok() logic should check for too big arrays too.
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index 4312935f1dfc..d03a44d89649 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -871,7 +871,7 @@ static int put_v4l2_ext_controls32(struct file *file, get_user(kcontrols, &kp->controls)) return -EFAULT; - if (!count) + if (!count || count > (U32_MAX/sizeof(*ucontrols))) return 0; if (get_user(p, &up->controls)) return -EFAULT; |