From: P J P <ppandit@redhat.com>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>, John Snow <jsnow@redhat.com>,
Prasad J Pandit <pjp@fedoraproject.org>,
Zuozhi fzz <zuozhi.fzz@alibaba-inc.com>
Subject: [Qemu-devel] [PATCH] exec: check 'bounce.in_use' flag before using buffer
Date: Thu, 28 Jan 2016 20:45:25 +0530 [thread overview]
Message-ID: <1453994125-23586-1-git-send-email-ppandit@redhat.com> (raw)
From: Prasad J Pandit <pjp@fedoraproject.org>
When IDE AHCI emulation uses Frame Information Structures(FIS)
engine for data transfer, the mapped FIS buffer address is stored
in a static 'bounce.buffer'. This is freed when FIS entry is
unmapped. If multiple FIS entries are created, it leads to an
use after free error. Check 'bounce.in_use' flag to avoid it.
Reported-by: Zuozhi fzz <zuozhi.fzz@alibaba-inc.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
exec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/exec.c b/exec.c
index 8718a75..ccc5715 100644
--- a/exec.c
+++ b/exec.c
@@ -2922,7 +2922,7 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
memory_region_unref(mr);
return;
}
- if (is_write) {
+ if (bounce.in_use && is_write) {
address_space_write(as, bounce.addr, MEMTXATTRS_UNSPECIFIED,
bounce.buffer, access_len);
}
--
2.5.0
next reply other threads:[~2016-01-28 15:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-28 15:15 P J P [this message]
2016-01-28 15:30 ` [Qemu-devel] [PATCH] exec: check 'bounce.in_use' flag before using buffer Peter Maydell
2016-01-28 18:09 ` P J P
2016-01-28 18:15 ` Peter Maydell
2016-01-28 19:01 ` P J P
2016-01-28 19:53 ` P J P
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=1453994125-23586-1-git-send-email-ppandit@redhat.com \
--to=ppandit@redhat.com \
--cc=jsnow@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pjp@fedoraproject.org \
--cc=qemu-devel@nongnu.org \
--cc=zuozhi.fzz@alibaba-inc.com \
/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).