]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
common/RefCountedObject: fix use-after-free in debug print 2145/head
authorSage Weil <sage@redhat.com>
Fri, 25 Jul 2014 20:17:32 +0000 (13:17 -0700)
committerSage Weil <sage@redhat.com>
Fri, 25 Jul 2014 20:17:32 +0000 (13:17 -0700)
commitf3609205e71de0b6e00fd4f5a9fffe7476d5fd73
tree3989368b58bc9fca4a3dfec4d4d756ce5754af86
parentd8eb65606918b56087dc3e0fa4cf6b2889eab5bd
common/RefCountedObject: fix use-after-free in debug print

We could race with another thread that deletes this right after we call
dec().  Our access of cct would then become a use-after-free.  Valgrind
managed to turn this up.

Copy it into a local variable before the dec() to be safe, and move the
dout line below to make this possibility explicit and obvious in the code.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/RefCountedObj.h