qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] slirp: fix use-after-free
@ 2009-11-20 18:13 Mark McLoughlin
  0 siblings, 0 replies; only message in thread
From: Mark McLoughlin @ 2009-11-20 18:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: Mark McLoughlin, Jan Kiszka

460fec67ee introduced a use-after free in slirp.

Cc: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---

Untested fix, but it's obvious.

Also, this is needed on stable-0.11.

 slirp/mbuf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/slirp/mbuf.c b/slirp/mbuf.c
index 7652fea..87508ba 100644
--- a/slirp/mbuf.c
+++ b/slirp/mbuf.c
@@ -95,8 +95,8 @@ m_free(struct mbuf *m)
 	 * Either free() it or put it on the free list
 	 */
 	if (m->m_flags & M_DOFREE) {
-		free(m);
 		m->slirp->mbuf_alloced--;
+		free(m);
 	} else if ((m->m_flags & M_FREELIST) == 0) {
 		insque(m,&m->slirp->m_freelist);
 		m->m_flags = M_FREELIST; /* Clobber other flags */
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-11-20 18:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-20 18:13 [Qemu-devel] [PATCH] slirp: fix use-after-free Mark McLoughlin

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).