diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-11 10:59:04 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-11 10:59:04 +0000 |
commit | e3a89a5d24cd86c3ed3e6cf3a182fd1bdb9fc855 (patch) | |
tree | c82ce6f581e39779052086ef3d7efdf9c581ad72 /ipc/ipc_channel_nacl.h | |
parent | c6fe36be35540c722cd7d1778272d1f27b4c82ae (diff) | |
download | chromium_src-e3a89a5d24cd86c3ed3e6cf3a182fd1bdb9fc855.zip chromium_src-e3a89a5d24cd86c3ed3e6cf3a182fd1bdb9fc855.tar.gz chromium_src-e3a89a5d24cd86c3ed3e6cf3a182fd1bdb9fc855.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
Review URL: https://codereview.chromium.org/183553004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256188 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, |