error path in usb serial if tty_port_block_til_ready fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

the current error handling in serial_open does not inform the subdrivers
if tty_port_block_til_ready fails. This breaks the semantics the subdrivers
expect. The calls to open and close must be balanced.

	Regards
		Oliver

Signed-off-by: Oliver Neukum <oliver@xxxxxxxxxx>
---

--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -248,9 +248,13 @@ static int serial_open (struct tty_struct *tty, struct file *filp)
 	mutex_unlock(&port->mutex);
 	/* Now do the correct tty layer semantics */
 	retval = tty_port_block_til_ready(&port->port, tty, filp);
-	if (retval == 0)
-		return 0;
+	if (retval)
+		goto bailout_close_again;
 
+	return 0;
+bailout_close_again:
+	if (serial->type->close)
+		serial->type->close(port);
 bailout_interface_put:
 	usb_autopm_put_interface(serial->interface);
 bailout_module_put:

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux