patch "USB: serial: mos7840: fix NULL-deref at open" added to usb-linus
Subsystems (3)
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 my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
Quoted 1 line
From
5c75633ef751dd4cd8f443dc35152c1ae563162eMon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Tue, 3 Jan 2017 16:39:55 +0100
Subject: USB: serial: mos7840: fix NULL-deref at open
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.
--- drivers/usb/serial/mos7840.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/usb/serial/mos7840.c +12 -0
@@ -2113,6 +2113,17 @@ static int mos7840_calc_num_ports(struct usb_serial *serial)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;
@@ -2388,6 +2399,7 @@ static struct usb_serial_driver moschip7840_4port_device = { .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,
Signature · 1 line
2.11.0