]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
staging: vc04_services: prevent integer overflow in create_pagelist()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 15 May 2019 09:38:33 +0000 (12:38 +0300)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit3fea485bf42df5249495c0969beb62d29f42a555
treeae503532a34b0818a9720bf11a789208444eb366
parentcb8658ed57b1c6c9468d7126f621b6722a4cae25
staging: vc04_services: prevent integer overflow in create_pagelist()

BugLink: https://bugs.launchpad.net/bugs/1838700
commit ca641bae6da977d638458e78cd1487b6160a2718 upstream.

The create_pagelist() "count" parameter comes from the user in
vchiq_ioctl() and it could overflow.  If you look at how create_page()
is called in vchiq_prepare_bulk_data(), then the "size" variable is an
int so it doesn't make sense to allow negatives or larger than INT_MAX.

I don't know this code terribly well, but I believe that typical values
of "count" are typically quite low and I don't think this check will
affect normal valid uses at all.

The "pagelist_size" calculation can also overflow on 32 bit systems, but
not on 64 bit systems.  I have added an integer overflow check for that
as well.

The Raspberry PI doesn't offer the same level of memory protection that
x86 does so these sorts of bugs are probably not super critical to fix.

Fixes: 71bad7f08641 ("staging: add bcm2708 vchiq driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c