qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: qemu-devel@nongnu.org, Paul Brook <paul@codesourcery.com>
Subject: [Qemu-devel] [PULL 1/7] char/cadence_uart: Fix reset for unattached instances
Date: Mon, 15 Jul 2013 17:01:29 +0100	[thread overview]
Message-ID: <1373904095-27592-2-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1373904095-27592-1-git-send-email-peter.maydell@linaro.org>

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

commit 1db8b5efe0c2b5000e50691eea61264a615f43de introduced an issue
where QEMU would segfault if you have an unattached Cadence UART.

Fix by guarding the flush-on-reset logic on there being a qemu_chr
attachment.

Reported-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Tested-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Message-id: 9009578ee10a50d994b2e10aa2840d73765f5968.1370577272.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/char/cadence_uart.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index 131370a..4d457f8 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -157,7 +157,9 @@ static void uart_rx_reset(UartState *s)
 {
     s->rx_wpos = 0;
     s->rx_count = 0;
-    qemu_chr_accept_input(s->chr);
+    if (s->chr) {
+        qemu_chr_accept_input(s->chr);
+    }
 
     s->r[R_SR] |= UART_SR_INTR_REMPTY;
     s->r[R_SR] &= ~UART_SR_INTR_RFUL;
-- 
1.7.9.5

  reply	other threads:[~2013-07-15 16:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-15 16:01 [Qemu-devel] [PULL 0/7] arm-devs queue Peter Maydell
2013-07-15 16:01 ` Peter Maydell [this message]
2013-07-15 16:01 ` [Qemu-devel] [PULL 2/7] hw/cpu/a15mpcore: Correct default value for num-irq Peter Maydell
2013-07-15 16:01 ` [Qemu-devel] [PULL 3/7] sd/pl181.c: Avoid undefined shift behaviour in RWORD macro Peter Maydell
2013-07-15 16:01 ` [Qemu-devel] [PULL 4/7] hw/dma/omap_dma: Fix bugs with DMA requests above 32 Peter Maydell
2013-07-15 16:01 ` [Qemu-devel] [PULL 5/7] hw/arm/vexpress: Add alias for flash at address 0 on A15 board Peter Maydell
2013-07-15 16:01 ` [Qemu-devel] [PULL 6/7] ARM/highbank: prepare for adding similar machines Peter Maydell
2013-07-15 16:01 ` [Qemu-devel] [PULL 7/7] ARM/highbank: add support for Calxeda ECX-2000 / Midway Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373904095-27592-2-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=aliguori@us.ibm.com \
    --cc=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).