]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/MgrStandby: prevent use-after-free on just-shut-down Mgr 15297/head
authorSage Weil <sage@redhat.com>
Thu, 25 May 2017 22:25:27 +0000 (18:25 -0400)
committerSage Weil <sage@redhat.com>
Thu, 25 May 2017 22:25:27 +0000 (18:25 -0400)
Fixes: http://tracker.ceph.com/issues/19595
Signed-off-by: Sage Weil <sage@redhat.com>
src/mgr/MgrStandby.cc
src/mgr/MgrStandby.h

index 1bfcadd71b45b5401219cf432a1ca2c1b4ddf1f5..bc946e41c18c9d7968e538629c1b618c7d69b0e9 100644 (file)
@@ -258,8 +258,9 @@ bool MgrStandby::ms_dispatch(Message *m)
 
     default:
       if (active_mgr) {
+       auto am = active_mgr;
         lock.Unlock();
-        active_mgr->ms_dispatch(m);
+        am->ms_dispatch(m);
         lock.Lock();
       } else {
         return false;
index d33c633dc424ebf4569f7286f3372de9579163a8..b60d591018ea777dde4fc77b48cec1a2eb174281 100644 (file)
@@ -53,7 +53,7 @@ protected:
   Mutex lock;
   SafeTimer timer;
 
-  std::unique_ptr<Mgr> active_mgr;
+  std::shared_ptr<Mgr> active_mgr;
 
   std::string state_str();