diff options
| author | Hugo Villeneuve <hvilleneuve@dimonoff.com> | 2026-04-10 11:20:13 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-05-11 17:19:52 +0200 |
| commit | 091ea8e5d34e1dca5d8f30127173b949e3f803ce (patch) | |
| tree | c9c09e1c33c9c0b4481fb8796a670c193811312f /rust/zerocopy/src/pointer/git@git.tavy.me:linux-stable.git | |
| parent | 1097aedec77674fe4f08f40b3f0bac26ea437fc0 (diff) | |
serial: core: prevent division by zero by always returning non-zero baud rate
If a device has a minimum baud rate > 9600 bauds, and a new termios baud
rate of 0 (hang up) is requested, uart_get_baud_rate() will return 0.
Most drivers do not check this return value and call uart_update_timeout()
with this zero baud rate, which will trigger a "Division by zero in kernel"
fault:
stty -F /dev/ttySC0 0
Division by zero in kernel.
...
Fix by returning the larger of 9600 or min for the B0 case. This now
ensures that a non-zero baud rate is returned, and greatly simplifies the
code.
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://patch.msgid.link/20260410152022.2146488-6-hugo@hugovil.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'rust/zerocopy/src/pointer/git@git.tavy.me:linux-stable.git')
0 files changed, 0 insertions, 0 deletions
