]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: initialize createparams zone_placement to avoid garbage value
authorSeena Fallah <seenafallah@gmail.com>
Thu, 10 Oct 2024 20:55:44 +0000 (22:55 +0200)
committerSeena Fallah <seenafallah@gmail.com>
Thu, 10 Oct 2024 20:57:13 +0000 (22:57 +0200)
When creating a bucket from a secondary zonegroup and forwarding
the request to the master zonegroup
(i.e., when `bucket_zonegroup != &my_zonegroup`), the
`createparams.zone_placement` may remain uninitialized. This can
lead to garbage values and result in a segmentation fault due to
invalid memory access.

By explicitly initializing `zone_placement` to `nullptr`, we can
eliminate this issue in cases where zone_placement is referenced
like `init_default_bucket_layout`.

Fixes: https://tracker.ceph.com/issues/68500
Signed-off-by: Seena Fallah <seenafallah@gmail.com>
src/rgw/rgw_sal.h

index 769d743544239230bc94f391c9df09449385b829..365dbb28634488a93b9d3ad26491c01801081358 100644 (file)
@@ -874,7 +874,7 @@ class Bucket {
       std::string zonegroup_id;
       rgw_placement_rule placement_rule;
       // zone placement is optional on buckets created for another zonegroup
-      const RGWZonePlacementInfo* zone_placement;
+      const RGWZonePlacementInfo* zone_placement = nullptr;
       RGWAccessControlPolicy policy;
       Attrs attrs;
       bool obj_lock_enabled = false;