qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] char: serial: check divider value against ba


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2] char: serial: check divider value against baud base
Date: Wed, 12 Oct 2016 10:13:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0


On 12/10/2016 07:58, P J P wrote:
> From: Prasad J Pandit <address@hidden>
> 
> 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 <address@hidden>
> Signed-off-by: Prasad J Pandit <address@hidden>
> ---
>  hw/char/serial.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Update per
>   -> https://lists.gnu.org/archive/html/qemu-devel/2016-10/msg02400.html
> 
> diff --git a/hw/char/serial.c b/hw/char/serial.c
> index 3442f47..eec72b7 100644
> --- a/hw/char/serial.c
> +++ b/hw/char/serial.c
> @@ -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;
> 

Queued, thanks.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]