[strongSwan-dev] [PATCH 1/1] Migrate queued_tasks tasks, to avoid dangling pointers

Thomas Egerer thomas.egerer at secunet.com
Tue Jun 29 08:53:05 CEST 2010


Hello Martin, *,

please consider the attached patch for inclusion into strongswan.
It issues the problem of dangling keymat pointers, once an ike_sa
is reset. You do migrate the active jobs, but if a queued job (like
a create_child job does, for example) aren't reset in this step they
still hold pointers to invalid, hence dangling pointers.

Cheers,

Thomas

---
 src/libcharon/sa/task_manager.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/libcharon/sa/task_manager.c b/src/libcharon/sa/task_manager.c
index 8857186..568f31a 100644
--- a/src/libcharon/sa/task_manager.c
+++ b/src/libcharon/sa/task_manager.c
@@ -1003,6 +1003,13 @@ METHOD(task_manager_t, reset, void,
 	}
 	this->initiating.type = EXCHANGE_TYPE_UNDEFINED;

+	/* reset queued tasks */
+	while (this->queued_tasks->remove_last(this->queued_tasks,
+										   (void**)&task) == SUCCESS)
+	{
+		task->migrate(task, this->ike_sa);
+		this->queued_tasks->insert_first(this->queued_tasks, task);
+	}
 	/* reset active tasks */
 	while (this->active_tasks->remove_last(this->active_tasks,
 										   (void**)&task) == SUCCESS)
-- 
1.7.1





More information about the Dev mailing list