]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: fix use-after-free during yielded closing 49022/head
authorYingxin Cheng <yingxin.cheng@intel.com>
Wed, 23 Nov 2022 05:46:47 +0000 (13:46 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Wed, 23 Nov 2022 05:46:47 +0000 (13:46 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/net/Protocol.h

index fb95a446432dea9c78cd85a6bb8b6db9c65c2f04..782b357b9df33bdc6036d217f3eba386b217f9da 100644 (file)
@@ -34,7 +34,8 @@ class Protocol {
     // seastar::parallel_for_each(). otherwise, we could erase a connection in
     // the container when seastar::parallel_for_each() is still iterating in
     // it. that'd lead to a segfault.
-    return seastar::yield().then([this, dispatch_reset] {
+    return seastar::yield(
+    ).then([this, dispatch_reset, conn_ref = conn.shared_from_this()] {
       close(dispatch_reset);
       // it can happen if close_clean() is called inside Dispatcher::ms_handle_reset()
       // which will otherwise result in deadlock