Re: [patch 2/6] tty: export tty_open_by_driver

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

 



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@xxxxxxxxx>
> Reviewed-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
> 
> 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
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux