diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2012-07-20 13:34:49 +0100 |
---|---|---|
committer | Peter Maydell <petmay01@cam-vm-266.(none)> | 2012-07-20 13:34:49 +0100 |
commit | 0d4abda8f7328c8911c1d020bb6961650eaf7801 (patch) | |
tree | f975cc0627bb1d190fd195c5fa3f1de42e81d36a /hw/pl011.c | |
parent | 61dc008f3529fa74a63aad1907438dad857e255a (diff) | |
download | qemu-0d4abda8f7328c8911c1d020bb6961650eaf7801.zip qemu-0d4abda8f7328c8911c1d020bb6961650eaf7801.tar.gz qemu-0d4abda8f7328c8911c1d020bb6961650eaf7801.tar.bz2 |
hw/pl011.c: Avoid crash on read when no chr backend present
Add a missing guard that meant we would segfault if the guest read
UARTDR on a PL011 serial device which had no chr backend connected.
(This didn't happen for Linux guests because Linux reads the flags
register and doesn't try to read the UART if it's empty.)
Reported-by: Christian Müller <christian.mueller@heig-vd.ch>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/pl011.c')
-rw-r--r-- | hw/pl011.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -78,7 +78,9 @@ static uint64_t pl011_read(void *opaque, target_phys_addr_t offset, if (s->read_count == s->read_trigger - 1) s->int_level &= ~ PL011_INT_RX; pl011_update(s); - qemu_chr_accept_input(s->chr); + if (s->chr) { + qemu_chr_accept_input(s->chr); + } return c; case 1: /* UARTCR */ return 0; |