Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Unified Diff: ipc/ipc_mojo_bootstrap.cc

Issue 2494483003: Mojo Bindings: Fix lock-order inversion in associated controllers (Closed)
Patch Set: . Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/sanitizers/tsan_suppressions.cc ('k') | mojo/public/cpp/bindings/lib/multiplex_router.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_mojo_bootstrap.cc
diff --git a/ipc/ipc_mojo_bootstrap.cc b/ipc/ipc_mojo_bootstrap.cc
index 8f27cbd477bc5c14980de00f649fed3910304233..3ba136619a6bd920a3f0929284c5e4927f14f913 100644
--- a/ipc/ipc_mojo_bootstrap.cc
+++ b/ipc/ipc_mojo_bootstrap.cc
@@ -169,6 +169,8 @@ class ChannelAssociatedGroupController
if (!is_local) {
DCHECK(ContainsKey(endpoints_, id));
DCHECK(!mojo::IsMasterInterfaceId(id));
+
+ base::AutoUnlock unlocker(lock_);
control_message_proxy_.NotifyEndpointClosedBeforeSent(id);
return;
}
@@ -179,6 +181,7 @@ class ChannelAssociatedGroupController
DCHECK(!endpoint->closed());
MarkClosedAndMaybeRemove(endpoint);
+ base::AutoUnlock unlocker(lock_);
if (!mojo::IsMasterInterfaceId(id))
control_message_proxy_.NotifyPeerEndpointClosed(id);
}
@@ -742,10 +745,13 @@ class ChannelAssociatedGroupController
if (mojo::IsMasterInterfaceId(id))
return false;
- base::AutoLock locker(lock_);
- Endpoint* endpoint = FindOrInsertEndpoint(id, nullptr);
- DCHECK(!endpoint->closed());
- MarkClosedAndMaybeRemove(endpoint);
+ {
+ base::AutoLock locker(lock_);
+ Endpoint* endpoint = FindOrInsertEndpoint(id, nullptr);
+ DCHECK(!endpoint->closed());
+ MarkClosedAndMaybeRemove(endpoint);
+ }
+
control_message_proxy_.NotifyPeerEndpointClosed(id);
return true;
}
@@ -762,6 +768,8 @@ class ChannelAssociatedGroupController
mojo::FilterChain filters_;
mojo::PipeControlMessageHandler control_message_handler_;
ControlMessageProxyThunk control_message_proxy_thunk_;
+
+ // NOTE: It is unsafe to call into this object while holding |lock_|.
mojo::PipeControlMessageProxy control_message_proxy_;
// Outgoing messages that were sent before this controller was bound to a
« no previous file with comments | « build/sanitizers/tsan_suppressions.cc ('k') | mojo/public/cpp/bindings/lib/multiplex_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698