[245/270] USB: mct_u232: fix broken close

Submitted by Ben Hutchings on Nov. 27, 2012, 4:15 p.m.

Details

Message ID 1354032951.4266.61.camel@deadeye.wl.decadent.org.uk
State New
Headers show

Commit Message

Ben Hutchings Nov. 27, 2012, 4:15 p.m.
On Mon, 2012-11-26 at 14:58 -0200, Herton Ronaldo Krzesinski wrote:
> 3.5.7u1 -stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Johan Hovold <jhovold@gmail.com>
> 
> commit 5260e458f5eff269a43e4f1e9c47186c57b88ddb upstream.
> 
> Make sure generic close is called at close.
> 
> The driver relies on the generic write implementation but did not call
> generic close.
> 
> Note that the call to kill the read urb is not redundant, as mct_u232
> uses an interrupt urb from the second port as the read urb and that
> generic close therefore fails to kill it.
> 
> Compile-only tested.
> 
> Signed-off-by: Johan Hovold <jhovold@gmail.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
[...]

This is missing on 3.4; the version I used for 3.2 (attached) should be
applicable.

Ben.

Comments

Greg KH Nov. 30, 2012, 1:23 a.m.
On Tue, Nov 27, 2012 at 04:15:51PM +0000, Ben Hutchings wrote:
> On Mon, 2012-11-26 at 14:58 -0200, Herton Ronaldo Krzesinski wrote:
> > 3.5.7u1 -stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Johan Hovold <jhovold@gmail.com>
> > 
> > commit 5260e458f5eff269a43e4f1e9c47186c57b88ddb upstream.
> > 
> > Make sure generic close is called at close.
> > 
> > The driver relies on the generic write implementation but did not call
> > generic close.
> > 
> > Note that the call to kill the read urb is not redundant, as mct_u232
> > uses an interrupt urb from the second port as the read urb and that
> > generic close therefore fails to kill it.
> > 
> > Compile-only tested.
> > 
> > Signed-off-by: Johan Hovold <jhovold@gmail.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
> [...]
> 
> This is missing on 3.4; the version I used for 3.2 (attached) should be
> applicable.

Thanks, that works.

greg k-h

Patch hide | download patch | download mbox

From: Johan Hovold <jhovold@gmail.com>
Date: Thu, 25 Oct 2012 10:29:14 +0200
Subject: USB: mct_u232: fix broken close

commit 5260e458f5eff269a43e4f1e9c47186c57b88ddb upstream.

Make sure generic close is called at close.

The driver relies on the generic write implementation but did not call
generic close.

Note that the call to kill the read urb is not redundant, as mct_u232
uses an interrupt urb from the second port as the read urb and that
generic close therefore fails to kill it.

Compile-only tested.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/serial/mct_u232.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -577,12 +577,14 @@  static void mct_u232_close(struct usb_se
 {
 	dbg("%s port %d", __func__, port->number);
 
-	if (port->serial->dev) {
-		/* shutdown our urbs */
-		usb_kill_urb(port->write_urb);
-		usb_kill_urb(port->read_urb);
-		usb_kill_urb(port->interrupt_in_urb);
-	}
+	/*
+	 * Must kill the read urb as it is actually an interrupt urb, which
+	 * generic close thus fails to kill.
+	 */
+	usb_kill_urb(port->read_urb);
+	usb_kill_urb(port->interrupt_in_urb);
+
+	usb_serial_generic_close(port);
 } /* mct_u232_close */