[Freeipa-devel] [PATCH] Fix race condition leading to segfaults

Simo Sorce ssorce at redhat.com
Thu Jul 23 20:18:15 UTC 2009


Sumit found out that ldap auth would segfault from time to time.

The problem was the way ldap_result() works you don't know how many
results are in the pipe so you have to keep polling, once the fde fired,
until you get back a 0.

The problem although, was that once a result was received the calling
function, upon getting called by op->callback(), could decide to free
the sdap_handle and all dependent memory like it happens in
sdap_pam_auth_done() which is called through a chain of callbacks from
sdap_process_message()

The following patch addresses the problem using, temporarily a timer
event to schedule any other call only after the callback is finished.
The events are appended on the sdap_handle, so that if the function
being called actually frees it, all pending events are also freed
without risk.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-race-condition-that-was-causing-segfaults.patch
Type: text/x-patch
Size: 9503 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20090723/9205b417/attachment.bin>


More information about the Freeipa-devel mailing list