提交 0d4abda8 编写于 作者: P Peter Maydell 提交者: Peter Maydell

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: NChristian Müller <christian.mueller@heig-vd.ch>
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
上级 61dc008f
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册