Re: [PATCH v2] serial: 8250_pci: fix divide error bug if baud rate is 0

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

 



On Tue, 2016-04-26 at 16:40 +0200, David Müller wrote:
> Since commit 21947ba654 (serial: 8250_pci: replace switch-case by 
> formula), the 8250 driver crashes in the byt_set_termios() function
> with 
> a divide error. This is caused by the fact that a baud rate of 0 (B0)
> is 
> not handled properly.

Please, add that you fall back to 9600 in this case.

You may add Fixes tag as well as Cc to stable@ if needed.

> 
> Signed-off-by: David Müller <d.mueller@xxxxxxxxx>
> ---

FWIW:
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

> v2: use a more elegant fix as suggested by Andy Shevchenko

We have Suggested-by tag ;-)

> 
>  drivers/tty/serial/8250/8250_pci.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/tty/serial/8250/8250_pci.c
> b/drivers/tty/serial/8250/8250_pci.c
> index 98862aa..d7c8125 100644
> --- a/drivers/tty/serial/8250/8250_pci.c
> +++ b/drivers/tty/serial/8250/8250_pci.c
> @@ -1377,6 +1377,9 @@ byt_set_termios(struct uart_port *p, struct
> ktermios *termios,
>  	unsigned long m, n;
>  	u32 reg;
>  
> +	/* gracefully handle the B0 case */

Capital letter first.

/* Gracefully handle the B0 case: fall back to B9600 */

> +	fuart = fuart ? fuart : 9600 * 16;
> +
>  	/* Get Fuart closer to Fref */
>  	fuart *= rounddown_pow_of_two(fref / fuart);
>  

-- 
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy

--
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