[patch 2/6] tty: export tty_open_by_driver

Greg Kroah-Hartman gregkh at linuxfoundation.org
Mon May 15 10:31:18 UTC 2017


On Sat, Apr 29, 2017 at 08:52:59PM +0100, Okash Khawaja wrote:
> This applies on top of the changes already in staging-next branch which allow
> kernel access to TTY dev.
> 
> Signe-doff-by: Okash Khawaja <okash.khawaja at gmail.com>
> Reviewed-by: Samuel Thibault <samuel.thibault at ens-lyon.org>
> 
> Index: linux-staging/drivers/tty/tty_io.c
> ===================================================================
> --- linux-staging.orig/drivers/tty/tty_io.c
> +++ linux-staging/drivers/tty/tty_io.c
> @@ -1369,7 +1369,10 @@ static struct tty_struct *tty_driver_loo
>  	struct tty_struct *tty;
>  
>  	if (driver->ops->lookup)
> -		tty = driver->ops->lookup(driver, file, idx);
> +		if (!file)
> +			tty = ERR_PTR(-EIO);
> +		else
> +			tty = driver->ops->lookup(driver, file, idx);

Why make this change?  Shouldn't the lookup function allow a NULL file
pointer?  Or is the problem that they do not?

>  	else
>  		tty = driver->ttys[idx];
>  
> @@ -2001,7 +2004,7 @@ static struct tty_driver *tty_lookup_dri
>  		struct tty_driver *console_driver = console_device(index);
>  		if (console_driver) {
>  			driver = tty_driver_kref_get(console_driver);
> -			if (driver) {
> +			if (driver && filp) {

Why change this too?

Your changelog does not explain any of this, please do so.

thanks,

greg k-h


More information about the devel mailing list