* [Qemu-devel] [PATCH for-1.3] hw/ide/macio: Fix segfault caused by NULL DMAContext*
@ 2012-11-20 18:16 Peter Maydell
2012-11-23 16:07 ` Alexander Graf
0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2012-11-20 18:16 UTC (permalink / raw)
To: qemu-devel
Cc: Amadeusz Sławiński, Anthony Liguori, Alexander Graf,
patches
Pass qemu_sglist_init the global dma_context_memory rather than a NULL
pointer; this fixes a segfault in dma_memory_map() when the guest
starts using DMA.
Reported-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Test case: download the squeeze standard image from
http://people.debian.org/~aurel32/qemu/powerpc/
and run with
qemu-system-ppc -hda debian_squeeze_powerpc_standard.qcow2
Without this patch it will crash as soon as Linux tries to
talk to the disk (the boot loader is OK as it doesn't DMA).
Obvious for-1.3 bugfix.
hw/ide/macio.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index 720af6e..d2edcc0 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -76,7 +76,8 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int ret)
s->io_buffer_size = io->len;
- qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1, NULL);
+ qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1,
+ &dma_context_memory);
qemu_sglist_add(&s->sg, io->addr, io->len);
io->addr += io->len;
io->len = 0;
@@ -132,7 +133,8 @@ static void pmac_ide_transfer_cb(void *opaque, int ret)
s->io_buffer_index = 0;
s->io_buffer_size = io->len;
- qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1, NULL);
+ qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1,
+ &dma_context_memory);
qemu_sglist_add(&s->sg, io->addr, io->len);
io->addr += io->len;
io->len = 0;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH for-1.3] hw/ide/macio: Fix segfault caused by NULL DMAContext*
2012-11-20 18:16 [Qemu-devel] [PATCH for-1.3] hw/ide/macio: Fix segfault caused by NULL DMAContext* Peter Maydell
@ 2012-11-23 16:07 ` Alexander Graf
0 siblings, 0 replies; 2+ messages in thread
From: Alexander Graf @ 2012-11-23 16:07 UTC (permalink / raw)
To: Peter Maydell
Cc: Amadeusz Sławiński, Anthony Liguori, qemu-devel,
patches
On 20.11.2012, at 19:16, Peter Maydell wrote:
> Pass qemu_sglist_init the global dma_context_memory rather than a NULL
> pointer; this fixes a segfault in dma_memory_map() when the guest
> starts using DMA.
>
> Reported-by: Amadeusz Sławiński <amade@asmblr.net>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Thanks, applied to ppc-next.
Alex
> ---
> Test case: download the squeeze standard image from
> http://people.debian.org/~aurel32/qemu/powerpc/
> and run with
> qemu-system-ppc -hda debian_squeeze_powerpc_standard.qcow2
> Without this patch it will crash as soon as Linux tries to
> talk to the disk (the boot loader is OK as it doesn't DMA).
>
> Obvious for-1.3 bugfix.
>
> hw/ide/macio.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/hw/ide/macio.c b/hw/ide/macio.c
> index 720af6e..d2edcc0 100644
> --- a/hw/ide/macio.c
> +++ b/hw/ide/macio.c
> @@ -76,7 +76,8 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int ret)
>
> s->io_buffer_size = io->len;
>
> - qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1, NULL);
> + qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1,
> + &dma_context_memory);
> qemu_sglist_add(&s->sg, io->addr, io->len);
> io->addr += io->len;
> io->len = 0;
> @@ -132,7 +133,8 @@ static void pmac_ide_transfer_cb(void *opaque, int ret)
> s->io_buffer_index = 0;
> s->io_buffer_size = io->len;
>
> - qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1, NULL);
> + qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1,
> + &dma_context_memory);
> qemu_sglist_add(&s->sg, io->addr, io->len);
> io->addr += io->len;
> io->len = 0;
> --
> 1.7.9.5
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-23 16:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-20 18:16 [Qemu-devel] [PATCH for-1.3] hw/ide/macio: Fix segfault caused by NULL DMAContext* Peter Maydell
2012-11-23 16:07 ` Alexander Graf
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).