X-Git-Url: http://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2Frx%2Frx.c;h=651136a2afbfa3eed7a60111ff2d89254a3304d7;hp=e84cf32de49c9ec711594703618699e1c6f40f7e;hb=b1ad473be01162fe9b3835544a835c4dcf0fcb35;hpb=328590dc5669cae3db6c509871b612b0384ea33d diff --git a/src/rx/rx.c b/src/rx/rx.c index e84cf32..651136a 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -6702,27 +6702,30 @@ rxi_SendDelayedCallAbort(struct rxevent *event, void *arg1, void *dummy, * * This routine is both an event handler and a function called directly; * when called directly the passed |event| is NULL and the - * conn->conn->data>lock must must not be held. + * conn->conn->data>lock must must not be held. Also, when called as an + * an event handler, we must putConnection before we exit; but when called + * directly (the first challenge), we must NOT putConnection. */ static void rxi_ChallengeEvent(struct rxevent *event, void *arg0, void *arg1, int tries) { struct rx_connection *conn = arg0; + int event_raised = 0; /* assume we were called directly */ MUTEX_ENTER(&conn->conn_data_lock); - if (event != NULL && event == conn->challengeEvent) + if (event != NULL && event == conn->challengeEvent) { + event_raised = 1; /* called as an event */ rxevent_Put(&conn->challengeEvent); + } MUTEX_EXIT(&conn->conn_data_lock); /* If there are no active calls it is not worth re-issuing the * challenge. If the client issues another call on this connection * the challenge can be requested at that time. */ - if (!rxi_HasActiveCalls(conn)) { - putConnection(conn); - return; - } + if (!rxi_HasActiveCalls(conn)) + goto done; if (RXS_CheckAuthentication(conn->securityObject, conn) != 0) { struct rx_packet *packet; @@ -6748,8 +6751,7 @@ rxi_ChallengeEvent(struct rxevent *event, } } MUTEX_EXIT(&conn->conn_call_lock); - putConnection(conn); - return; + goto done; } packet = rxi_AllocPacket(RX_PACKET_CLASS_SPECIAL); @@ -6774,7 +6776,9 @@ rxi_ChallengeEvent(struct rxevent *event, } MUTEX_EXIT(&conn->conn_data_lock); } - putConnection(conn); + done: + if (event_raised) + putConnection(conn); } /* Call this routine to start requesting the client to authenticate