Skip to contentSkip to conversation

FAILED: patch "[PATCH] USB: serial: metro-usb: stop I/O after failed open" failed to apply to 4.4-stable tree

PATCH [email protected] 1 participant 1 message Nov 19, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 2339536d229df25c71c0900fc619289229bfecf6 Mon Sep 17 00:00:00 2001

From: Johan Hovold <[email protected]>
Date: Thu, 12 Oct 2017 10:54:21 +0200
Subject: [PATCH] USB: serial: metro-usb: stop I/O after failed open

Make sure to kill the interrupt-in URB after a failed open request. Apart from saving power (and avoiding stale input after a later successful open), this also prevents a NULL-deref in the completion handler if the port is manually unbound.

Fixes 704577861d5e ("USB: serial: metro-usb: get data from device in Uni-Directional mode.")
Cc stable <[email protected]> # 3.5
drivers/usb/serial/metro-usb.c +8 -3
index cc84da8dbb84..4bb29e03dae4 100644
@@ -188,7 +188,7 @@ static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port)
 		dev_err(&port->dev,
 			"%s - failed submitting interrupt in urb, error code=%d\n",
 			__func__, result);
-		goto exit;
+		return result;
 	}
 
 	/* Send activate cmd to device */
@@ -197,9 +197,14 @@ static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port)
 		dev_err(&port->dev,
 			"%s - failed to configure device, error code=%d\n",
 			__func__, result);
-		goto exit;
+		goto err_kill_urb;
 	}
-exit:
+
+	return 0;
+
+err_kill_urb:
+	usb_kill_urb(port->interrupt_in_urb);
+
 	return result;
 }