|
|
c401cc |
From 633498ff40c5876607a7c4b0ccd23d13374373ab Mon Sep 17 00:00:00 2001
|
|
|
c401cc |
Message-Id: <633498ff40c5876607a7c4b0ccd23d13374373ab@dist-git>
|
|
|
c401cc |
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
|
|
|
c401cc |
Date: Thu, 20 Mar 2014 00:06:19 -0600
|
|
|
c401cc |
Subject: [PATCH] nwfilter: Fix double free of pointer
|
|
|
c401cc |
|
|
|
c401cc |
https://bugzilla.redhat.com/show_bug.cgi?id=1071181
|
|
|
c401cc |
|
|
|
c401cc |
Commit 49b59a15 fixed one problem but masks another one related to pointer
|
|
|
c401cc |
freeing.
|
|
|
c401cc |
|
|
|
c401cc |
Avoid putting of the virNWFilterSnoopReq once the thread has been started.
|
|
|
c401cc |
It belongs to the thread and the thread will call virNWFilterSnoopReqPut() on it.
|
|
|
c401cc |
|
|
|
c401cc |
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
|
|
|
c401cc |
|
|
|
c401cc |
(cherry picked from commit 963dcf905c5ee0358d6b0b74b124ff340cbbbd2b)
|
|
|
c401cc |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c401cc |
---
|
|
|
c401cc |
src/nwfilter/nwfilter_dhcpsnoop.c | 6 +++++-
|
|
|
c401cc |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
c401cc |
|
|
|
c401cc |
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
|
|
|
c401cc |
index e7dd4fa..caa453f 100644
|
|
|
c401cc |
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
|
|
|
c401cc |
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
|
|
|
c401cc |
@@ -1598,6 +1598,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
|
|
|
c401cc |
int tmp;
|
|
|
c401cc |
virThread thread;
|
|
|
c401cc |
virNWFilterVarValuePtr dhcpsrvrs;
|
|
|
c401cc |
+ bool threadPuts = false;
|
|
|
c401cc |
|
|
|
c401cc |
virNWFilterSnoopIFKeyFMT(ifkey, vmuuid, macaddr);
|
|
|
c401cc |
|
|
|
c401cc |
@@ -1691,6 +1692,8 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
|
|
|
c401cc |
goto exit_snoopreq_unlock;
|
|
|
c401cc |
}
|
|
|
c401cc |
|
|
|
c401cc |
+ threadPuts = true;
|
|
|
c401cc |
+
|
|
|
c401cc |
virAtomicIntInc(&virNWFilterSnoopState.nThreads);
|
|
|
c401cc |
|
|
|
c401cc |
req->threadkey = virNWFilterSnoopActivate(req);
|
|
|
c401cc |
@@ -1730,7 +1733,8 @@ exit_rem_ifnametokey:
|
|
|
c401cc |
exit_snoopunlock:
|
|
|
c401cc |
virNWFilterSnoopUnlock();
|
|
|
c401cc |
exit_snoopreqput:
|
|
|
c401cc |
- virNWFilterSnoopReqPut(req);
|
|
|
c401cc |
+ if (!threadPuts)
|
|
|
c401cc |
+ virNWFilterSnoopReqPut(req);
|
|
|
c401cc |
|
|
|
c401cc |
return -1;
|
|
|
c401cc |
}
|
|
|
c401cc |
--
|
|
|
c401cc |
1.9.1
|
|
|
c401cc |
|