]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
pybind/rbd: handle non-existent groups properly in list_snaps() 70256/head
authorVinayBhaskar-V <vvarada@redhat.com>
Thu, 9 Jul 2026 16:00:26 +0000 (21:30 +0530)
committerVinayBhaskar-V <vvarada@redhat.com>
Thu, 16 Jul 2026 15:03:34 +0000 (20:33 +0530)
commit07b21358e5aa42f3e806c30ea27d871cd86111bc
treea5fcc397386735414dcc14e38bbea1b7ddfe7f13
parent6757b86898288311827728c16a50cc5c57b6e69c
pybind/rbd: handle non-existent groups properly in list_snaps()

Calling `list_snaps()` on a non-existent group crashed the entire
Python process with a `free(): invalid pointer` error. This happened
because an unexpected `-ENOENT` error returned by `rbd_group_snap_list2`
and the exception was raised without updating the num_group_snaps to 0
from 10. Later the Cython `__dealloc__` wrapper attempted to free garbage
of uninitialized pointer spaces resulting in a crash.

Fix this behavior by resetting `self.num_group_snaps` to 0 inside
`GroupSnapIterator` before raising exception to prevent memory
corruption and accessing uninitialized pointers during cleanup call

Now `list_snaps()` consistently raise an `ObjectNotFound` error when
invoked on a non-existent group.
Also Extended the `TestGroups` test fixture with `self.dne_group` to
validate the expected error path for `list_snaps()`.

Fixes: https://tracker.ceph.com/issues/78034
Signed-off-by: VinayBhaskar-V <vvarada@redhat.com>
(cherry picked from commit 56bcf706cf91f0734899ae9de378c459a9b5af50)
src/pybind/rbd/rbd.pyx
src/test/pybind/test_rbd.py