Re: [PATCH -next] serial: omap: fix potential NULL pointer dereference in serial_omap_runtime_suspend()

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

 



* Wei Yongjun <weiyj.lk@xxxxxxxxx> [130604 19:10]:
> From: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
> 
> The dereference to 'up' should be moved below the NULL test.
> Introduced by commit ddd85e225c8885b5e4419b0499ab27100e7c366a
> (serial: omap: prevent runtime PM for "no_console_suspend")

Acked-by: Tony Lindgren <tony@xxxxxxxxxxx>
 
> Signed-off-by: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
> ---
>  drivers/tty/serial/omap-serial.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
> index 1aaeca8..156b5aa 100644
> --- a/drivers/tty/serial/omap-serial.c
> +++ b/drivers/tty/serial/omap-serial.c
> @@ -1613,6 +1613,9 @@ static int serial_omap_runtime_suspend(struct device *dev)
>  	struct uart_omap_port *up = dev_get_drvdata(dev);
>  	struct omap_uart_port_info *pdata = dev->platform_data;
>  
> +	if (!up)
> +		return -EINVAL;
> +
>  	/*
>  	* When using 'no_console_suspend', the console UART must not be
>  	* suspended. Since driver suspend is managed by runtime suspend,
> @@ -1623,9 +1626,6 @@ static int serial_omap_runtime_suspend(struct device *dev)
>  	    uart_console(&up->port))
>  		return -EBUSY;
>  
> -	if (!up)
> -		return -EINVAL;
> -
>  	if (!pdata)
>  		return 0;
>  
> 
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss@xxxxxxxxxxxxxxxx
> https://lists.ozlabs.org/listinfo/devicetree-discuss
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux