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

* Re: [Qemu-devel] [PATCH] char: serial: check divider value against baud base
  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
  1 sibling, 1 reply; 4+ messages in thread
From: no-reply @ 2016-10-12  0:57 UTC (permalink / raw)
  To: ppandit; +Cc: famz, qemu-devel, pbonzini, psirt, pjp, mst

Hi,

Your series seems to have some coding style problems. See output below for
more information:

Subject: [Qemu-devel] [PATCH] char: serial: check divider value against baud base
Message-id: 1476203260-5290-1-git-send-email-ppandit@redhat.com
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git show --no-patch --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
7aea007 char: serial: check divider value against baud base

=== OUTPUT BEGIN ===
Checking PATCH 1/1: char: serial: check divider value against baud base...
ERROR: braces {} are necessary for all arms of this statement
#25: FILE: hw/char/serial.c:156:
+    if (s->divider == 0 || s->divider > s->baudbase)
[...]

total: 1 errors, 0 warnings, 8 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org

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

* Re: [Qemu-devel] [PATCH] char: serial: check divider value against baud base
  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  1:39 ` Huawei PSIRT
  1 sibling, 0 replies; 4+ messages in thread
From: Huawei PSIRT @ 2016-10-12  1:39 UTC (permalink / raw)
  To: ppandit, qemu-devel
  Cc: mst, pbonzini, pjp, yanghongke, Huawei PSIRT, Wanglijun (PSIRT)

Dear,

Thank you very much for your support. And will you assign a CVE-ID for the
issue?

Best regards,
Huawei PSIRT

-----邮件原件-----
发件人: P J P [mailto:ppandit@redhat.com] 
发送时间: 2016年10月12日 0:28
收件人: Qemu Developers
抄送: Michael S. Tsirkin; Paolo Bonzini; Huawei PSIRT; Prasad J Pandit
主题: [PATCH] char: serial: check divider value against baud base

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	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] char: serial: check divider value against baud base
  2016-10-12  0:57 ` no-reply
@ 2016-10-12  6:07   ` P J P
  0 siblings, 0 replies; 4+ messages in thread
From: P J P @ 2016-10-12  6:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: famz, pbonzini, psirt, mst

+-- On Tue, 11 Oct 2016, no-reply@ec2-52-6-146-230.compute-1.amazonaws.com wrote --+
| Your series seems to have some coding style problems.
| === OUTPUT BEGIN ===
| Checking PATCH 1/1: char: serial: check divider value against baud base...
| ERROR: braces {} are necessary for all arms of this statement
| #25: FILE: hw/char/serial.c:156:
| +    if (s->divider == 0 || s->divider > s->baudbase)
| [...]
| 
| Your patch has style problems, please review.

Ah sorry, I've sent a corrected patch v2.
--
Prasad J Pandit / Red Hat Product Security Team
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F

^ permalink raw reply	[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.