r20025@cathode-dark-space: jaltman | 2007-09-30 16:50:45 -0400
ticket: new
subject: NIM: BUG: LIB: deadlock in kmq
component: windows
Do not obtain a critical section that is already being held:
"cs_kmq_types"
Update the docs to indicate the additional restriction.
ticket: 5792
version_fixed: 1.6.3
git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@20066
dc483132-0cff-0310-8789-
dd5450dbe970
/*
* Copyright (c) 2005 Massachusetts Institute of Technology
+ *
+ * Copyright (c) 2007 Secure Endpoints Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
\brief Post a message to a subscriber
\note Obtains ::cs_kmq_msg_ref, ::cs_kmq_msg, kmq_queue::cs
\note Should be called with ::cs_kmq_msg held
+ \note Should be called with ::cs_kmq_types held if try_send is true
*/
void kmqint_post(kmq_msg_subscription * s, kmq_message * m, khm_boolean try_send) {
if(s->rcpt_type == KMQ_RCPTTYPE_CB) {
/*
* Copyright (c) 2005 Massachusetts Institute of Technology
*
+ * Copyright (c) 2007 Secure Endpoints Inc.
+ *
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
becomes active will exit with a KHM_ERROR_EXIT code.
kmq_send_thread_quit_message() will wait for this to happen before
returning.
+
+ This function should not be called by the thread identified by the
+ \a thread parameter.
*/
KHMEXP khm_int32 KHMAPI kmq_send_thread_quit_message(
kmq_thread_id thread,
/*
* Copyright (c) 2005 Massachusetts Institute of Technology
*
+ * Copyright (c) 2007 Secure Endpoints Inc.
+ *
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
} else
m->wait_o = NULL;
+ if (try_send)
+ EnterCriticalSection(&cs_kmq_types);
EnterCriticalSection(&cs_kmq_msg);
kmqint_post((kmq_msg_subscription *) sub, m, try_send);
kmqint_put_message(m);
}
LeaveCriticalSection(&cs_kmq_msg);
+ if (try_send)
+ LeaveCriticalSection(&cs_kmq_types);
return KHM_ERROR_SUCCESS;
}
} else
m->wait_o = NULL;
+ if (try_send)
+ EnterCriticalSection(&cs_kmq_types);
EnterCriticalSection(&cs_kmq_msg);
for(i=0;i<n_subs;i++) {
kmqint_post((kmq_msg_subscription *) subs[i], m, try_send);
kmqint_put_message(m);
}
LeaveCriticalSection(&cs_kmq_msg);
+ if (try_send)
+ EnterCriticalSection(&cs_kmq_types);
return KHM_ERROR_SUCCESS;
}
}
+