From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, luonengjun@huawei.com,
peter.huangpeng@huawei.com,
zhanghailiang <zhang.zhanghailiang@huawei.com>
Subject: [Qemu-devel] [PATCH v1] vl: Fix possible freed memory accessing
Date: Fri, 19 Sep 2014 11:37:28 +0800 [thread overview]
Message-ID: <1411097848-3900-1-git-send-email-zhang.zhanghailiang@huawei.com> (raw)
The logic of pcmcia_socket_unregister is wrong,
which will cause a freed memory accessing
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
---
Hi,
The function pcmcia_socket_unregister seemes to be unused,
Should it be removed? Thanks.
---
vl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/vl.c b/vl.c
index dc792fe..bf659b7 100644
--- a/vl.c
+++ b/vl.c
@@ -1545,11 +1545,13 @@ void pcmcia_socket_unregister(PCMCIASocket *socket)
struct pcmcia_socket_entry_s *entry, **ptr;
ptr = &pcmcia_sockets;
- for (entry = *ptr; entry; ptr = &entry->next, entry = *ptr)
+ for (entry = *ptr; entry; ptr = &entry->next, entry = *ptr) {
if (entry->socket == socket) {
*ptr = entry->next;
g_free(entry);
+ break;
}
+ }
}
void pcmcia_info(Monitor *mon, const QDict *qdict)
--
1.7.12.4
next reply other threads:[~2014-09-19 3:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-19 3:37 zhanghailiang [this message]
2014-09-19 6:54 ` [Qemu-devel] [PATCH v1] vl: Fix possible freed memory accessing Markus Armbruster
2014-09-19 14:14 ` Peter Maydell
2014-09-19 8:09 ` Paolo Bonzini
2014-09-20 13:58 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-09-22 6:23 ` Markus Armbruster
2014-09-22 7:34 ` Michael Tokarev
2014-10-23 6:33 ` Michael Tokarev
2014-10-23 6:52 ` Markus Armbruster
2014-10-23 7:16 ` Peter Maydell
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=1411097848-3900-1-git-send-email-zhang.zhanghailiang@huawei.com \
--to=zhang.zhanghailiang@huawei.com \
--cc=luonengjun@huawei.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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).