lkml.org 
[lkml]   [2017]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.2 083/199] USB: serial: spcp8x5: fix NULL-deref at open
    3.2.87-rc1 review patch.  If anyone has any objections, please let me know.

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

    From: Johan Hovold <johan@kernel.org>

    commit cc0909248258f679c4bb4cd315565d40abaf6bc6 upstream.

    Fix NULL-pointer dereference in open() should the device lack the
    expected endpoints:

    Unable to handle kernel NULL pointer dereference at virtual address 00000030
    ...
    PC is at spcp8x5_open+0x30/0xd0 [spcp8x5]

    Fixes: 619a6f1d1423 ("USB: add usb-serial spcp8x5 driver")
    Signed-off-by: Johan Hovold <johan@kernel.org>
    [bwh: Backported to 3.2: add this check to the existing
    usb_serial_driver::attach implementation]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    drivers/usb/serial/spcp8x5.c | 14 ++++++++++++++
    1 file changed, 14 insertions(+)

    --- a/drivers/usb/serial/spcp8x5.c
    +++ b/drivers/usb/serial/spcp8x5.c
    @@ -176,6 +176,13 @@ static int spcp8x5_startup(struct usb_se
    int i;
    enum spcp8x5_type type = SPCP825_007_TYPE;
    u16 product = le16_to_cpu(serial->dev->descriptor.idProduct);
    + unsigned char num_ports = serial->num_ports;
    +
    + if (serial->num_bulk_in < num_ports ||
    + serial->num_bulk_out < num_ports) {
    + dev_err(&serial->interface->dev, "missing endpoints\n");
    + return -ENODEV;
    + }

    if (product == 0x0201)
    type = SPCP825_007_TYPE;
    \
     
     \ /
      Last update: 2017-03-10 13:58    [W:4.108 / U:0.248 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site