]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
ceph: cleanup in check_new_map() method
authorViacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Thu, 11 Sep 2025 18:16:10 +0000 (11:16 -0700)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 11 Feb 2026 18:19:17 +0000 (19:19 +0100)
commitae1ddf5b7d42293d099b5e5a045a63ba2a748b44
treeb653293497043d9a26017558b330c3a4756fd2bb
parentea7c567dd3c6d72fc7f388d649cb852b3b36d886
ceph: cleanup in check_new_map() method

The Coverity Scan service has reported a potential issue
in check_new_map() method [1]. The check_new_map() executes
checking of newmap->m_info on NULL in the beginning of
the method. However, it operates by newmap->m_info later
in the method without any check on NULL. Analysis of the code
flow shows that ceph_mdsmap_decode() guarantees the allocation
of m_info array. And check_new_map() never will be called
with newmap->m_info not allocated.

This patch exchanges checking of newmap->m_info on BUG_ON()
pattern because the situation of having NULL in newmap->m_info
during check_new_map() is not expecting event. Also, this patch
reworks logic of __open_export_target_sessions(),
ceph_mdsmap_get_addr(), ceph_mdsmap_get_state(), and
ceph_mdsmap_is_laggy() by checking mdsmap->m_info on NULL value.

[1] https://scan5.scan.coverity.com/#/project-view/64304/10063?selectedIssue=1491799

Signed-off-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
cc: Alex Markuze <amarkuze@redhat.com>
cc: Ilya Dryomov <idryomov@gmail.com>
cc: Ceph Development <ceph-devel@vger.kernel.org>
fs/ceph/debugfs.c
fs/ceph/mds_client.c
fs/ceph/mdsmap.h