]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/notification: fix segmentation fault and topic listing logic 60774/head
authorOshrey Avraham <oshrey16@gmail.com>
Mon, 18 Nov 2024 10:06:22 +0000 (12:06 +0200)
committerYuval Lifshitz <ylifshit@ibm.com>
Tue, 19 Nov 2024 16:49:58 +0000 (16:49 +0000)
- Fixed a segmentation fault caused by a null bucket pointer in RGWPSListTopicsOp::execute()
- Corrected logic to use get_topics_v2 when supported, with fallback otherwise

Fixes: https://tracker.ceph.com/issues/68756
Signed-off-by: Oshrey Avraham <oshrey16@gmail.com>
(cherry picked from commit d27dab240d568a705ff45e2231be650673279ebe)

src/rgw/rgw_rest_pubsub.cc

index 01fdcceb54510d2d070c84150556df79d1ae17b6..9302de7e39bf499777ad4a198540d0f346a50588 100644 (file)
@@ -474,11 +474,11 @@ void RGWPSListTopicsOp::execute(optional_yield y) {
 
   const RGWPubSub ps(driver, get_account_or_tenant(s->owner.id), *s->penv.site);
   if (rgw::all_zonegroups_support(*s->penv.site, rgw::zone_features::notification_v2) &&
-      driver->stat_topics_v1(s->bucket->get_tenant(), null_yield, this) == -ENOENT) {
-    op_ret = ps.get_topics_v1(this, result, y);
-  } else {
+      driver->stat_topics_v1(get_account_or_tenant(s->owner.id), null_yield, this) == -ENOENT) {
     constexpr int max_items = 100;
     op_ret = ps.get_topics_v2(this, start_token, max_items, result, next_token, y);
+  } else {
+    op_ret = ps.get_topics_v1(this, result, y);
   }
   // if there are no topics it is not considered an error
   op_ret = op_ret == -ENOENT ? 0 : op_ret;