]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd/osd: fix sigsegv caused by reusing the moved objcect
authorluo rixin <luorixin@huawei.com>
Fri, 22 Jul 2022 08:48:14 +0000 (16:48 +0800)
committerluo rixin <luorixin@huawei.com>
Fri, 22 Jul 2022 08:48:32 +0000 (16:48 +0800)
In some case, `m` will be moved and setted nullptr before
`m->get_spg()` be called, causing a segmentation fault.

Signed-off-by: luo rixin <luorixin@huawei.com>
src/crimson/osd/osd.cc

index c940196426ef6287670d6610b072b46e88fb625e..a964523c5569da82aa6d2d03bc41be4a6bb6fb61 100644 (file)
@@ -1036,8 +1036,9 @@ seastar::future<> OSD::handle_rep_op(crimson::net::ConnectionRef conn,
 seastar::future<> OSD::handle_rep_op_reply(crimson::net::ConnectionRef conn,
                                           Ref<MOSDRepOpReply> m)
 {
+  spg_t pgid = m->get_spg();
   return pg_shard_manager.with_pg(
-    m->get_spg(),
+    pgid,
     [conn=std::move(conn), m=std::move(m)](auto &&pg) {
       if (pg) {
        m->finish_decode();