Commit 6092e4b9 authored by Johan Hovold's avatar Johan Hovold Committed by Ben Hutchings

USB: garmin_gps: fix memory leak on disconnect

commit 618aa106 upstream.

Remove bogus disconnect test introduced by 95bef012 ("USB: more serial
drivers writing after disconnect") which prevented queued data from
being freed on disconnect.

The possible IO it was supposed to prevent is long gone.
Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent bbb8c223
...@@ -973,10 +973,7 @@ static void garmin_close(struct usb_serial_port *port) ...@@ -973,10 +973,7 @@ static void garmin_close(struct usb_serial_port *port)
if (!serial) if (!serial)
return; return;
mutex_lock(&port->serial->disc_mutex); garmin_clear(garmin_data_p);
if (!port->serial->disconnected)
garmin_clear(garmin_data_p);
/* shutdown our urbs */ /* shutdown our urbs */
usb_kill_urb(port->read_urb); usb_kill_urb(port->read_urb);
...@@ -985,8 +982,6 @@ static void garmin_close(struct usb_serial_port *port) ...@@ -985,8 +982,6 @@ static void garmin_close(struct usb_serial_port *port)
/* keep reset state so we know that we must start a new session */ /* keep reset state so we know that we must start a new session */
if (garmin_data_p->state != STATE_RESET) if (garmin_data_p->state != STATE_RESET)
garmin_data_p->state = STATE_DISCONNECTED; garmin_data_p->state = STATE_DISCONNECTED;
mutex_unlock(&port->serial->disc_mutex);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment