All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] char: serial: check divider value against baud base
@ 2016-10-11 16:27 P J P
  2016-10-12  0:57 ` no-reply
  2016-10-12  1:39 ` Huawei PSIRT
  0 siblings, 2 replies; 4+ messages in thread
From: P J P @ 2016-10-11 16:27 UTC (permalink / raw)
  To: Qemu Developers
  Cc: Michael S. Tsirkin, Paolo Bonzini, Huawei PSIRT, Prasad J Pandit

From: Prasad J Pandit <pjp@fedoraproject.org>

16550A UART device uses an oscillator to generate frequencies
(baud base), which decide communication speed. This speed could
be changed by dividing it by a divider. If the divider is
greater than the baud base, speed is set to zero, leading to a
divide by zero error. Add check to avoid it.

Reported-by: Huawei PSIRT <psirt@huawei.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
 hw/char/serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/char/serial.c b/hw/char/serial.c
index 3442f47..f659bbd 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -153,7 +153,7 @@ static void serial_update_parameters(SerialState *s)
     int speed, parity, data_bits, stop_bits, frame_size;
     QEMUSerialSetParams ssp;
 
-    if (s->divider == 0)
+    if (s->divider == 0 || s->divider > s->baudbase)
         return;
 
     /* Start bit. */
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-12  6:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-11 16:27 [Qemu-devel] [PATCH] char: serial: check divider value against baud base P J P
2016-10-12  0:57 ` no-reply
2016-10-12  6:07   ` P J P
2016-10-12  1:39 ` Huawei PSIRT

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.