From: "Richard W.M. Jones" <rjones@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/2] Don't call fw_cfg e->callback if e->callback is NULL.
Date: Sat, 17 Jul 2010 14:40:08 +0100 [thread overview]
Message-ID: <20100717134008.GA20292@amd.home.annexia.org> (raw)
In-Reply-To: <20100717133930.GC19767@amd.home.annexia.org>
[-- Attachment #1: Type: text/plain, Size: 268 bytes --]
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
[-- Attachment #2: 0001-Don-t-call-fw_cfg-e-callback-if-e-callback-is-NULL.patch --]
[-- Type: text/plain, Size: 1111 bytes --]
>From aded1d171a2b8f12830a43b3a0893da9acb708ff Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones@redhat.com>
Date: Sat, 17 Jul 2010 14:23:21 +0100
Subject: [PATCH 1/2] Don't call fw_cfg e->callback if e->callback is NULL.
If you set up a fw_cfg writable entry without a callback, then
e->callback is still called, causing qemu to segfault.
Luckily since nothing in qemu uses writable entries at the moment,
this is not exploitable.
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
---
hw/fw_cfg.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 72866ae..37e6f1f 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -65,7 +65,8 @@ static void fw_cfg_write(FWCfgState *s, uint8_t value)
if (s->cur_entry & FW_CFG_WRITE_CHANNEL && s->cur_offset < e->len) {
e->data[s->cur_offset++] = value;
if (s->cur_offset == e->len) {
- e->callback(e->callback_opaque, e->data);
+ if (e->callback)
+ e->callback(e->callback_opaque, e->data);
s->cur_offset = 0;
}
}
--
1.7.1
next prev parent reply other threads:[~2010-07-17 13:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-17 13:39 [Qemu-devel] [PATCH 0/2] fw_cfg: Implement fast "blit" operation for rapidly copying in kernel, initrd [etc] into the guest Richard W.M. Jones
2010-07-17 13:40 ` Richard W.M. Jones [this message]
2010-07-17 13:41 ` [Qemu-devel] [PATCH 2/2] fw_cfg: Add blit operation for copying kernel, initrd, Richard W.M. Jones
2010-07-18 20:47 ` Alexander Graf
2010-07-18 21:12 ` Richard W.M. Jones
2010-07-18 21:13 ` Alexander Graf
2010-07-18 23:59 ` Aurelien Jarno
2010-07-19 7:23 ` Richard W.M. Jones
2010-07-19 9:19 ` Aurelien Jarno
2010-07-19 10:15 ` [Qemu-devel] [PATCH 0/2 version 2] fw_cfg: Implement fast "DMA"-type operation for rapidly copying in kernel, initrd [etc] into the guest Richard W.M. Jones
2010-07-19 10:15 ` [Qemu-devel] [PATCH 1/2 version 2] Don't call fw_cfg e->callback if e->callback is NULL Richard W.M. Jones
2010-07-19 10:16 ` [Qemu-devel] [PATCH 2/2 version 2] fw_cfg: Allow guest to read kernel etc via fast, synchronous "DMA"-type operation Richard W.M. Jones
2010-07-19 10:45 ` [Qemu-devel] Re: [PATCH 0/2 version 2] fw_cfg: Implement fast "DMA"-type operation for rapidly copying in kernel, initrd [etc] into the guest Gleb Natapov
2010-07-19 10:49 ` Richard W.M. Jones
2010-07-19 10:56 ` Gleb Natapov
2010-07-19 11:30 ` [Qemu-devel] [PATCH 2/2 version 3] " Richard W.M. Jones
2010-07-20 14:41 ` [Qemu-devel] [PATCH 2/2 version 4] " Richard W.M. Jones
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=20100717134008.GA20292@amd.home.annexia.org \
--to=rjones@redhat.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).