From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwzMC-0000BX-MP for qemu-devel@nongnu.org; Thu, 12 Nov 2015 16:24:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwzM7-0000If-QE for qemu-devel@nongnu.org; Thu, 12 Nov 2015 16:24:36 -0500 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Thu, 12 Nov 2015 22:24:08 +0100 Message-Id: <1447363448-20405-1-git-send-email-hpoussin@reactos.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH for-2.5] mac_dbdma: always initialize channel field in DBDMA_channel List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "open list:Old World" , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Mark Cave-Ayland , Alexander Graf dbdma_from_ch() uses channel field to return the right DBDMA object. Previous code was working if guest OS was only using registered DMA chann= els. However, it lead to QEMU crashes if guest OS was using unregistered DMA c= hannels. Signed-off-by: Herv=C3=A9 Poussineau --- hw/misc/macio/mac_dbdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c index 779683c..5ee8f02 100644 --- a/hw/misc/macio/mac_dbdma.c +++ b/hw/misc/macio/mac_dbdma.c @@ -557,7 +557,6 @@ void DBDMA_register_channel(void *dbdma, int nchan, q= emu_irq irq, DBDMA_DPRINTF("DBDMA_register_channel 0x%x\n", nchan); =20 ch->irq =3D irq; - ch->channel =3D nchan; ch->rw =3D rw; ch->flush =3D flush; ch->io.opaque =3D opaque; @@ -753,6 +752,7 @@ void* DBDMA_init (MemoryRegion **dbdma_mem) for (i =3D 0; i < DBDMA_CHANNELS; i++) { DBDMA_io *io =3D &s->channels[i].io; qemu_iovec_init(&io->iov, 1); + s->channels[i].channel =3D i; } =20 memory_region_init_io(&s->mem, NULL, &dbdma_ops, s, "dbdma", 0x1000)= ; --=20 2.1.4