From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:40276 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934835AbdAIKbe (ORCPT ); Mon, 9 Jan 2017 05:31:34 -0500 Subject: Patch "USB: serial: mos7840: fix NULL-deref at open" has been added to the 4.4-stable tree To: johan@kernel.org, gregkh@linuxfoundation.org Cc: , From: Date: Mon, 09 Jan 2017 11:31:28 +0100 Message-ID: <1483957888158162@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: mos7840: fix NULL-deref at open to the 4.4-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-mos7840-fix-null-deref-at-open.patch and it can be found in the queue-4.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From 5c75633ef751dd4cd8f443dc35152c1ae563162e Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Tue, 3 Jan 2017 16:39:55 +0100 Subject: USB: serial: mos7840: fix NULL-deref at open From: Johan Hovold commit 5c75633ef751dd4cd8f443dc35152c1ae563162e 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 mos7840_open+0x88/0x8dc [mos7840] Note that we continue to treat the interrupt-in endpoint as optional for now. Fixes: 3f5429746d91 ("USB: Moschip 7840 USB-Serial Driver") Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/mos7840.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -2116,6 +2116,17 @@ static int mos7840_calc_num_ports(struct return mos7840_num_ports; } +static int mos7840_attach(struct usb_serial *serial) +{ + if (serial->num_bulk_in < serial->num_ports || + serial->num_bulk_out < serial->num_ports) { + dev_err(&serial->interface->dev, "missing endpoints\n"); + return -ENODEV; + } + + return 0; +} + static int mos7840_port_probe(struct usb_serial_port *port) { struct usb_serial *serial = port->serial; @@ -2391,6 +2402,7 @@ static struct usb_serial_driver moschip7 .tiocmset = mos7840_tiocmset, .tiocmiwait = usb_serial_generic_tiocmiwait, .get_icount = usb_serial_generic_get_icount, + .attach = mos7840_attach, .port_probe = mos7840_port_probe, .port_remove = mos7840_port_remove, .read_bulk_callback = mos7840_bulk_in_callback, Patches currently in stable-queue which might be from johan@kernel.org are queue-4.4/usb-serial-io_ti-fix-i-o-after-disconnect.patch queue-4.4/usb-serial-ti_usb_3410_5052-fix-null-deref-at-open.patch queue-4.4/usb-serial-kobil_sct-fix-null-deref-in-write.patch queue-4.4/usb-serial-spcp8x5-fix-null-deref-at-open.patch queue-4.4/usb-serial-mos7720-fix-parallel-probe.patch queue-4.4/usb-serial-cyberjack-fix-null-deref-at-open.patch queue-4.4/usb-serial-mos7720-fix-null-deref-at-open.patch queue-4.4/usb-serial-garmin_gps-fix-memory-leak-on-failed-urb-submit.patch queue-4.4/usb-serial-io_ti-fix-null-deref-at-open.patch queue-4.4/usb-serial-pl2303-fix-null-deref-at-open.patch queue-4.4/usb-serial-quatech2-fix-sleep-while-atomic-in-close.patch queue-4.4/usb-serial-iuu_phoenix-fix-null-deref-at-open.patch queue-4.4/usb-serial-oti6858-fix-null-deref-at-open.patch queue-4.4/usb-serial-io_edgeport-fix-null-deref-at-open.patch queue-4.4/usb-serial-mos7720-fix-parport-use-after-free-on-probe-errors.patch queue-4.4/usb-serial-mos7720-fix-use-after-free-on-probe-errors.patch queue-4.4/usb-serial-mos7840-fix-null-deref-at-open.patch queue-4.4/usb-serial-omninet-fix-null-derefs-at-open-and-disconnect.patch queue-4.4/usb-serial-keyspan_pda-verify-endpoints-at-probe.patch queue-4.4/usb-serial-io_ti-fix-another-null-deref-at-open.patch