]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: rados_ioctx_destroy check for initialized ioctx 47452/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:11:53 +0000 (08:11 +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 93b29911da37bb3080d4894a5d457ee226b93661..792768b9d8f9678f5fd4a09817992701746c9523 100644 (file)
@@ -1174,7 +1174,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);