mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	usb-serial: fix termios initialization logic
This patch (as1288) fixes the initialization logic in serial_install(). A new tty always needs to have a termios initialized no matter what, not just in the case where the lower driver will override the termios settings. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
		
							parent
							
								
									cc56cd0157
								
							
						
					
					
						commit
						7e29bb4b77
					
				
					 1 changed files with 10 additions and 12 deletions
				
			
		| 
						 | 
					@ -210,22 +210,21 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty)
 | 
				
			||||||
	if (!try_module_get(serial->type->driver.owner))
 | 
						if (!try_module_get(serial->type->driver.owner))
 | 
				
			||||||
		goto error_module_get;
 | 
							goto error_module_get;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* perform the standard setup */
 | 
				
			||||||
 | 
						retval = tty_init_termios(tty);
 | 
				
			||||||
 | 
						if (retval)
 | 
				
			||||||
 | 
							goto error_init_termios;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	retval = usb_autopm_get_interface(serial->interface);
 | 
						retval = usb_autopm_get_interface(serial->interface);
 | 
				
			||||||
	if (retval)
 | 
						if (retval)
 | 
				
			||||||
		goto error_get_interface;
 | 
							goto error_get_interface;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* If the termios setup has yet to be done */
 | 
					 | 
				
			||||||
	if (tty->driver->termios[idx] == NULL) {
 | 
					 | 
				
			||||||
		/* perform the standard setup */
 | 
					 | 
				
			||||||
		retval = tty_init_termios(tty);
 | 
					 | 
				
			||||||
		if (retval)
 | 
					 | 
				
			||||||
			goto error_init_termios;
 | 
					 | 
				
			||||||
		/* allow the driver to update it */
 | 
					 | 
				
			||||||
		if (serial->type->init_termios)
 | 
					 | 
				
			||||||
			serial->type->init_termios(tty);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	mutex_unlock(&serial->disc_mutex);
 | 
						mutex_unlock(&serial->disc_mutex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* allow the driver to update the settings */
 | 
				
			||||||
 | 
						if (serial->type->init_termios)
 | 
				
			||||||
 | 
							serial->type->init_termios(tty);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tty->driver_data = port;
 | 
						tty->driver_data = port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Final install (we use the default method) */
 | 
						/* Final install (we use the default method) */
 | 
				
			||||||
| 
						 | 
					@ -234,9 +233,8 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty)
 | 
				
			||||||
	driver->ttys[idx] = tty;
 | 
						driver->ttys[idx] = tty;
 | 
				
			||||||
	return retval;
 | 
						return retval;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 error_init_termios:
 | 
					 | 
				
			||||||
	usb_autopm_put_interface(serial->interface);
 | 
					 | 
				
			||||||
 error_get_interface:
 | 
					 error_get_interface:
 | 
				
			||||||
 | 
					 error_init_termios:
 | 
				
			||||||
	module_put(serial->type->driver.owner);
 | 
						module_put(serial->type->driver.owner);
 | 
				
			||||||
 error_module_get:
 | 
					 error_module_get:
 | 
				
			||||||
 error_no_port:
 | 
					 error_no_port:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue