diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-03-19 12:09:23 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-03-21 13:50:28 +0100 |
commit | 59b6c01edcd7013a112aeaf9d0bc33a8d2a2b8f1 (patch) | |
tree | d4d0a938ca9ce3a1293f106b5d86213e9fda5079 | |
parent | 08814fc43536cb801b1db0c548bcc19b67b19dd4 (diff) |
libpager: fix potential deadlock
This patch releases the interlock before doing an rpc call, analogous
to 901c61a1d25e7c8963e51012760a82730eda1910.
* libpager/pager-attr.c (pager_change_attributes): Release interlock
before calling memory_object_change_attributes, to let the callbacks
take it.
-rw-r--r-- | libpager/pager-attr.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libpager/pager-attr.c b/libpager/pager-attr.c index 47da12ac..ad1560ea 100644 --- a/libpager/pager-attr.c +++ b/libpager/pager-attr.c @@ -77,11 +77,14 @@ pager_change_attributes (struct pager *p, } } + pthread_mutex_unlock (&p->interlock); memory_object_change_attributes (p->memobjcntl, may_cache, copy_strategy, wait ? p->port.port_right : MACH_PORT_NULL); if (wait) { + pthread_mutex_lock (&p->interlock); + while (ar->attrs_pending) pthread_cond_wait (&p->wakeup, &p->interlock); @@ -92,7 +95,7 @@ pager_change_attributes (struct pager *p, ar->next->prevp = ar->prevp; free (ar); } + + pthread_mutex_unlock (&p->interlock); } - - pthread_mutex_unlock (&p->interlock); } |