• Dan Carpenter's avatar
    staging: vc04_services: prevent integer overflow in create_pagelist() · ca641bae
    Dan Carpenter authored
    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: 71bad7f0 ("staging: add bcm2708 vchiq driver")
    Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    ca641bae
vchiq_2835_arm.c 15.5 KB