trusty-ipc: Fix a race condition in tipc_release
Under certain conditions it is possible that an instance of
tipc_dn_chan structure will be freed in context of tipc_release
call while still be referenced and in use by corresponding
instance of tipc_chan struct. In order to fix that, we will need
to make sure that corresponding tipc_chan struct is not in use
before freeing tipc_dn_chan struct. This CL introduces and
implements a new callback in tipc_chan_ops struct, called
handle_release, that when specified will be called while an
instance of tipc_chan object is getting destroyed. This is
only possible when the last reference to tipc_chan struct
goes away so it is not in use anymore.
Change-Id: I93849aab08e09374a9f8ca9fa00351839519027d
Signed-off-by:
Michael Ryleev <gmar@google.com>
Loading