]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fixes recursive lock problem in manager.c
authorDavid Vossel <dvossel@digium.com>
Thu, 21 Oct 2010 16:14:33 +0000 (16:14 +0000)
committerDavid Vossel <dvossel@digium.com>
Thu, 21 Oct 2010 16:14:33 +0000 (16:14 +0000)
It is possible for a AMI session to freeze because of invalid
use of recursive locks during the EVENT processing.  This
patch removes the unnecessary locks.

(closes issue #18167)
Reported by: sustav
Patches:
      manager_locking_v1.diff uploaded by dvossel (license 671)
Tested by: sustav

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@292595 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index c5e313e9e05df2f58046f0634947650221ce67c7..494dcfbfc30f8336c06d07151fd036638925a2cd 100644 (file)
@@ -2834,7 +2834,6 @@ static int action_waitevent(struct mansession *s, const struct message *m)
        if (s->session->waiting_thread == pthread_self()) {
                struct eventqent *eqe = s->session->last_ev;
                astman_send_response(s, m, "Success", "Waiting for Event completed.");
-               AST_RWLIST_RDLOCK(&all_events);
                while ((eqe = advance_event(eqe))) {
                        if (((s->session->readperm & eqe->category) == eqe->category) &&
                            ((s->session->send_events & eqe->category) == eqe->category)) {
@@ -2842,7 +2841,6 @@ static int action_waitevent(struct mansession *s, const struct message *m)
                        }
                        s->session->last_ev = eqe;
                }
-               AST_RWLIST_UNLOCK(&all_events);
                astman_append(s,
                        "Event: WaitEventComplete\r\n"
                        "%s"
@@ -4107,7 +4105,7 @@ static int process_events(struct mansession *s)
        ao2_lock(s->session);
        if (s->session->f != NULL) {
                struct eventqent *eqe = s->session->last_ev;
-               AST_RWLIST_RDLOCK(&all_events);
+
                while ((eqe = advance_event(eqe))) {
                        if (!ret && s->session->authenticated &&
                            (s->session->readperm & eqe->category) == eqe->category &&
@@ -4119,7 +4117,6 @@ static int process_events(struct mansession *s)
                        }
                        s->session->last_ev = eqe;
                }
-               AST_RWLIST_UNLOCK(&all_events);
        }
        ao2_unlock(s->session);
        return ret;