diff options
author | Johan Hovold <johan@kernel.org> | 2017-01-03 10:39:40 -0500 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2017-01-04 04:37:14 -0500 |
commit | 3dca01114dcecb1cf324534cd8d75fd1306a516b (patch) | |
tree | e441fbb5031e9bca103758097e215209409d2fe9 | |
parent | 427157631648c980e8bba4d73a21508b9e1a47ec (diff) |
USB: serial: cyberjack: fix NULL-deref at open
Fix NULL-pointer dereference when clearing halt at open should the device
lack a bulk-out endpoint.
Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
PC is at cyberjack_open+0x40/0x9c [cyberjack]
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
-rw-r--r-- | drivers/usb/serial/cyberjack.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 5f17a3b9916d..80260b08398b 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #define CYBERJACK_PRODUCT_ID 0x0100 | 50 | #define CYBERJACK_PRODUCT_ID 0x0100 |
51 | 51 | ||
52 | /* Function prototypes */ | 52 | /* Function prototypes */ |
53 | static int cyberjack_attach(struct usb_serial *serial); | ||
53 | static int cyberjack_port_probe(struct usb_serial_port *port); | 54 | static int cyberjack_port_probe(struct usb_serial_port *port); |
54 | static int cyberjack_port_remove(struct usb_serial_port *port); | 55 | static int cyberjack_port_remove(struct usb_serial_port *port); |
55 | static int cyberjack_open(struct tty_struct *tty, | 56 | static int cyberjack_open(struct tty_struct *tty, |
@@ -77,6 +78,7 @@ static struct usb_serial_driver cyberjack_device = { | |||
77 | .description = "Reiner SCT Cyberjack USB card reader", | 78 | .description = "Reiner SCT Cyberjack USB card reader", |
78 | .id_table = id_table, | 79 | .id_table = id_table, |
79 | .num_ports = 1, | 80 | .num_ports = 1, |
81 | .attach = cyberjack_attach, | ||
80 | .port_probe = cyberjack_port_probe, | 82 | .port_probe = cyberjack_port_probe, |
81 | .port_remove = cyberjack_port_remove, | 83 | .port_remove = cyberjack_port_remove, |
82 | .open = cyberjack_open, | 84 | .open = cyberjack_open, |
@@ -100,6 +102,14 @@ struct cyberjack_private { | |||
100 | short wrsent; /* Data already sent */ | 102 | short wrsent; /* Data already sent */ |
101 | }; | 103 | }; |
102 | 104 | ||
105 | static int cyberjack_attach(struct usb_serial *serial) | ||
106 | { | ||
107 | if (serial->num_bulk_out < serial->num_ports) | ||
108 | return -ENODEV; | ||
109 | |||
110 | return 0; | ||
111 | } | ||
112 | |||
103 | static int cyberjack_port_probe(struct usb_serial_port *port) | 113 | static int cyberjack_port_probe(struct usb_serial_port *port) |
104 | { | 114 | { |
105 | struct cyberjack_private *priv; | 115 | struct cyberjack_private *priv; |