lkml.org 
[lkml]   [2017]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.4 071/103] [media] gspca: konica: add missing endpoint sanity check
    Date
    4.4-stable review patch.  If anyone has any objections, please let me know.

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

    From: Johan Hovold <johan@kernel.org>

    commit aa58fedb8c7b6cf2f05941d238495f9e2f29655c upstream.

    Make sure to check the number of endpoints to avoid accessing memory
    beyond the endpoint array should a device lack the expected endpoints.

    Note that, as far as I can tell, the gspca framework has already made
    sure there is at least one endpoint in the current alternate setting so
    there should be no risk for a NULL-pointer dereference here.

    Fixes: b517af722860 ("V4L/DVB: gspca_konica: New gspca subdriver for
    konica chipset using cams")

    Cc: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Hans Verkuil <hansverk@cisco.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/media/usb/gspca/konica.c | 3 +++
    1 file changed, 3 insertions(+)

    --- a/drivers/media/usb/gspca/konica.c
    +++ b/drivers/media/usb/gspca/konica.c
    @@ -188,6 +188,9 @@ static int sd_start(struct gspca_dev *gs
    return -EIO;
    }

    + if (alt->desc.bNumEndpoints < 2)
    + return -ENODEV;
    +
    packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);

    n = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;

    \
     
     \ /
      Last update: 2017-05-23 22:44    [W:4.034 / U:0.292 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site