]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: rados_ioctx_destroy check for initialized ioctx 47451/head
authorNitzanMordhai <nmordech@redhat.com>
Tue, 19 Jul 2022 08:35:32 +0000 (08:35 +0000)
committerNitzan Mordechai <nmordech@redhat.com>
Thu, 4 Aug 2022 05:10:21 +0000 (08:10 +0300)
If rados_ioctx_destroy called with un-initilized ioctx we will hit segmented fault
checking ioctx before calling put will prevent that.

Fixes: https://tracker.ceph.com/issues/55001
Signed-off-by: Nitzan Mordechai <nmordec@redhat.com>
(cherry picked from commit e465cfc62ae0f982edb60291c67f4d76a71efd15)

src/librados/librados_c.cc

index ca8f7c3c4890f5122b78a21b8fc54ef2f1304872..d3090c064ac5f40e49bc7131c3522b9689f4c959 100644 (file)
@@ -1157,7 +1157,9 @@ extern "C" void LIBRADOS_C_API_DEFAULT_F(rados_ioctx_destroy)(rados_ioctx_t io)
 {
   tracepoint(librados, rados_ioctx_destroy_enter, io);
   librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
-  ctx->put();
+  if (ctx) {
+    ctx->put();
+  }
   tracepoint(librados, rados_ioctx_destroy_exit);
 }
 LIBRADOS_C_API_BASE_DEFAULT(rados_ioctx_destroy);