Skip to content
Commit 07a708f0 authored by Ji-Ze Hong (Peter Hong)'s avatar Ji-Ze Hong (Peter Hong) Committed by Greg Kroah-Hartman
Browse files

serial: 8250_fintek: Fix crash with baud rate B0

The 8250_fintek.c is support the Fintek F81866/F81216 with dynamic clock.
But It'll generate "division by zero" exception and crash in
fintek_8250_set_termios() with baud rate 0 on baudrate_table[i] % baud.

It can be tested with following C code:

	...
	struct termios options;

	tcgetattr(fd, &options);
	...
	options.c_cflag = CS8 | CREAD; /* baud rate 0 */
	tcsetattr(fd, TCSANOW, &options);
	tcflush(fd, TCIOFLUSH);

Fixes: 195638b6

 ("serial: 8250_fintek: UART dynamic clocksource on Fintek F81866")
Reported-by: default avatarLukas Redlinger <rel+kernel@agilox.net>
Cc: Lukas Redlinger <rel+kernel@agilox.net>
Signed-off-by: default avatarJi-Ze Hong (Peter Hong) <hpeter+linux_kernel@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 21c4e7f2
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment