Commit 30d9d42e9a7c205cc139dce743463b8070684df5
Committed by
Greg Kroah-Hartman
1 parent
c3452f5e44
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
USB: cyberjack: fix disconnect handling
Make sure the interrupt urb submitted in port_probe is killed in port_remove. The interrupt-urb completion handler references the port and may get called after port_remove has returned and the port has been unregistered (although this is currently prevented by usb-serial core as we are using a non-private urb). Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 2 additions and 10 deletions Side-by-side Diff
drivers/usb/serial/cyberjack.c
... | ... | @@ -51,7 +51,6 @@ |
51 | 51 | #define CYBERJACK_PRODUCT_ID 0x0100 |
52 | 52 | |
53 | 53 | /* Function prototypes */ |
54 | -static void cyberjack_disconnect(struct usb_serial *serial); | |
55 | 54 | static int cyberjack_port_probe(struct usb_serial_port *port); |
56 | 55 | static int cyberjack_port_remove(struct usb_serial_port *port); |
57 | 56 | static int cyberjack_open(struct tty_struct *tty, |
... | ... | @@ -79,7 +78,6 @@ |
79 | 78 | .description = "Reiner SCT Cyberjack USB card reader", |
80 | 79 | .id_table = id_table, |
81 | 80 | .num_ports = 1, |
82 | - .disconnect = cyberjack_disconnect, | |
83 | 81 | .port_probe = cyberjack_port_probe, |
84 | 82 | .port_remove = cyberjack_port_remove, |
85 | 83 | .open = cyberjack_open, |
86 | 84 | |
... | ... | @@ -130,18 +128,12 @@ |
130 | 128 | { |
131 | 129 | struct cyberjack_private *priv; |
132 | 130 | |
131 | + usb_kill_urb(port->interrupt_in_urb); | |
132 | + | |
133 | 133 | priv = usb_get_serial_port_data(port); |
134 | 134 | kfree(priv); |
135 | 135 | |
136 | 136 | return 0; |
137 | -} | |
138 | - | |
139 | -static void cyberjack_disconnect(struct usb_serial *serial) | |
140 | -{ | |
141 | - int i; | |
142 | - | |
143 | - for (i = 0; i < serial->num_ports; ++i) | |
144 | - usb_kill_urb(serial->port[i]->interrupt_in_urb); | |
145 | 137 | } |
146 | 138 | |
147 | 139 | static int cyberjack_open(struct tty_struct *tty, |