From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:40454 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754173AbdAIKcm (ORCPT ); Mon, 9 Jan 2017 05:32:42 -0500 Subject: Patch "USB: serial: kobil_sct: fix NULL-deref in write" has been added to the 4.9-stable tree To: johan@kernel.org, gregkh@linuxfoundation.org Cc: , From: Date: Mon, 09 Jan 2017 11:32:20 +0100 Message-ID: <148395794037146@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled USB: serial: kobil_sct: fix NULL-deref in write to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: usb-serial-kobil_sct-fix-null-deref-in-write.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From 21ce57840243c7b70fbc1ebd3dceeb70bb6e9e09 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Tue, 3 Jan 2017 16:39:49 +0100 Subject: USB: serial: kobil_sct: fix NULL-deref in write From: Johan Hovold commit 21ce57840243c7b70fbc1ebd3dceeb70bb6e9e09 upstream. Fix NULL-pointer dereference in write() should the device lack the expected interrupt-out endpoint: Unable to handle kernel NULL pointer dereference at virtual address 00000054 ... PC is at kobil_write+0x144/0x2a0 [kobil_sct] Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/kobil_sct.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c @@ -51,6 +51,7 @@ /* Function prototypes */ +static int kobil_attach(struct usb_serial *serial); static int kobil_port_probe(struct usb_serial_port *probe); static int kobil_port_remove(struct usb_serial_port *probe); static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port); @@ -86,6 +87,7 @@ static struct usb_serial_driver kobil_de .description = "KOBIL USB smart card terminal", .id_table = id_table, .num_ports = 1, + .attach = kobil_attach, .port_probe = kobil_port_probe, .port_remove = kobil_port_remove, .ioctl = kobil_ioctl, @@ -113,6 +115,16 @@ struct kobil_private { }; +static int kobil_attach(struct usb_serial *serial) +{ + if (serial->num_interrupt_out < serial->num_ports) { + dev_err(&serial->interface->dev, "missing interrupt-out endpoint\n"); + return -ENODEV; + } + + return 0; +} + static int kobil_port_probe(struct usb_serial_port *port) { struct usb_serial *serial = port->serial; Patches currently in stable-queue which might be from johan@kernel.org are queue-4.9/usb-serial-io_ti-fix-i-o-after-disconnect.patch queue-4.9/usb-serial-ti_usb_3410_5052-fix-null-deref-at-open.patch queue-4.9/usb-serial-kobil_sct-fix-null-deref-in-write.patch queue-4.9/usb-serial-spcp8x5-fix-null-deref-at-open.patch queue-4.9/usb-serial-mos7720-fix-parallel-probe.patch queue-4.9/usb-serial-cyberjack-fix-null-deref-at-open.patch queue-4.9/usb-serial-mos7720-fix-null-deref-at-open.patch queue-4.9/usb-serial-garmin_gps-fix-memory-leak-on-failed-urb-submit.patch queue-4.9/usb-serial-io_ti-fix-null-deref-at-open.patch queue-4.9/usb-serial-pl2303-fix-null-deref-at-open.patch queue-4.9/usb-serial-quatech2-fix-sleep-while-atomic-in-close.patch queue-4.9/usb-serial-iuu_phoenix-fix-null-deref-at-open.patch queue-4.9/usb-serial-oti6858-fix-null-deref-at-open.patch queue-4.9/usb-serial-io_edgeport-fix-null-deref-at-open.patch queue-4.9/usb-serial-mos7720-fix-parport-use-after-free-on-probe-errors.patch queue-4.9/usb-serial-mos7720-fix-use-after-free-on-probe-errors.patch queue-4.9/usb-serial-mos7840-fix-null-deref-at-open.patch queue-4.9/usb-serial-omninet-fix-null-derefs-at-open-and-disconnect.patch queue-4.9/usb-serial-keyspan_pda-verify-endpoints-at-probe.patch queue-4.9/usb-serial-io_ti-fix-another-null-deref-at-open.patch