diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-20 21:00:50 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-20 21:00:50 +0000 |
commit | 7e3d75264e9fc8577743a0b3c26ffe4d5e95697c (patch) | |
tree | 15a2b4ce75ca1b7f52dacefa68ac267c0eaf404e /ipc/ipc_channel_nacl.h | |
parent | 26b3abb1724fa02e4464cf3d23f0e20ee3b18efc (diff) | |
download | chromium_src-7e3d75264e9fc8577743a0b3c26ffe4d5e95697c.zip chromium_src-7e3d75264e9fc8577743a0b3c26ffe4d5e95697c.tar.gz chromium_src-7e3d75264e9fc8577743a0b3c26ffe4d5e95697c.tar.bz2 |
Eliminate a potential race in IPC::ChannelProxy
Doing the following steps with ChannelProxy leads to a data race:
1) Create the ChannelProxy, but don't initialize it.
2) Add a filter.
3) Init the ChannelProxy.
The problem is, AddFilter() posts a task from the Listener thread to the IPC task runner to do OnAddFilter. Prior to this patch, OnAddFilter will try to read channel_ even though channel_ may not have been initialized, and it's accessed without any synchronization.
This patch only really adds the filter if peer_pid_ has been set on the IPC::Channel thread; otherwise, it waits until the connection has been established to really add filters.
See the bug for more detail.
BUG=244383
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=256188
Review URL: https://codereview.chromium.org/183553004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258406 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_nacl.h')
-rw-r--r-- | ipc/ipc_channel_nacl.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ipc/ipc_channel_nacl.h b/ipc/ipc_channel_nacl.h index a21730e..29a9d57 100644 --- a/ipc/ipc_channel_nacl.h +++ b/ipc/ipc_channel_nacl.h @@ -40,6 +40,7 @@ class Channel::ChannelImpl : public internal::ChannelReader { virtual ~ChannelImpl(); // Channel implementation. + base::ProcessId peer_pid() const; bool Connect(); void Close(); bool Send(Message* message); @@ -53,6 +54,7 @@ class Channel::ChannelImpl : public internal::ChannelReader { bool CreatePipe(const IPC::ChannelHandle& channel_handle); bool ProcessOutgoingMessages(); + void CallOnChannelConnected(); // ChannelReader implementation. virtual ReadState ReadData(char* buffer, |