patch "USB: serial: kobil_sct: fix NULL-deref in write" added to usb-linus
Subsystems (3)
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 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
21ce57840243c7b70fbc1ebd3dceeb70bb6e9e09Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Tue, 3 Jan 2017 16:39:49 +0100
Subject: USB: serial: kobil_sct: fix NULL-deref in write
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]
--- drivers/usb/serial/kobil_sct.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/usb/serial/kobil_sct.c +12 -0
@@ -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_device = { .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;
Signature · 1 line
2.11.0