* [Qemu-devel] [PATCH v2] char: serial: check divider value against baud base
@ 2016-10-12 5:58 P J P
2016-10-12 8:13 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: P J P @ 2016-10-12 5:58 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 | 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;
--
2.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH v2] char: serial: check divider value against baud base
2016-10-12 5:58 [Qemu-devel] [PATCH v2] char: serial: check divider value against baud base P J P
@ 2016-10-12 8:13 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2016-10-12 8:13 UTC (permalink / raw)
To: P J P, Qemu Developers; +Cc: Michael S. Tsirkin, Huawei PSIRT, Prasad J Pandit
On 12/10/2016 07:58, P J P wrote:
> 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 | 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-12 8:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-12 5:58 [Qemu-devel] [PATCH v2] char: serial: check divider value against baud base P J P
2016-10-12 8:13 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).