lkml.org 
[lkml]   [2018]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.9 081/101] media: v4l2-compat-ioctl32: prevent go past max size
    Date
    4.9-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Mauro Carvalho Chehab <mchehab@s-opensource.com>

    commit ea72fbf588ac9c017224dcdaa2019ff52ca56fee upstream.

    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>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
    +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
    @@ -864,7 +864,7 @@ static int put_v4l2_ext_controls32(struc
    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;

    \
     
     \ /
      Last update: 2018-07-01 18:29    [W:3.907 / U:0.100 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site