]> Git Repo - qemu.git/commitdiff
char: serial: check divider value against baud base
authorPrasad J Pandit <[email protected]>
Wed, 12 Oct 2016 05:58:08 +0000 (11:28 +0530)
committerPaolo Bonzini <[email protected]>
Mon, 24 Oct 2016 13:27:19 +0000 (15:27 +0200)
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 <[email protected]>
Signed-off-by: Prasad J Pandit <[email protected]>
Message-Id: <1476251888[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
hw/char/serial.c

index 3442f47d36844a73c3c3d6a1834616d1f51fdff0..eec72b7b9effec8ca25af917fb0313b11c2734a7 100644 (file)
@@ -153,8 +153,9 @@ 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. */
     frame_size = 1;
This page took 0.027223 seconds and 4 git commands to generate.