]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
msgr: ref count Pipe to avoid use after free
authorSage Weil <sage@newdream.net>
Thu, 17 Jun 2010 20:37:34 +0000 (13:37 -0700)
committerSage Weil <sage@newdream.net>
Thu, 17 Jun 2010 20:37:34 +0000 (13:37 -0700)
commitc6067131bdb367485a2847e78f169607fad42f90
tree9dd21792afb22a7f6aa5066a140da050131e5d43
parent920b2d897495f3e1bfe892e6470657c711220b83
msgr: ref count Pipe to avoid use after free

The Connection has a Pipe pointer to facilitate
 send_message(Message, Connection)
but the reaper() clears that pointer when tearing down old pipes.  This
leads to a race in which submit_message dereferences the old Pipe pointer.

Instead, make Pipe ref counted, and only submit_message() if we get a
valid Pipe reference.  This fixes races between send_message() and
reaper() (as well as any use of the Connection after the pipe is closed).

Signed-off-by: Sage Weil <sage@newdream.net>
src/msg/Message.h
src/msg/SimpleMessenger.cc
src/msg/SimpleMessenger.h