summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@cryptolab.net>2024-11-29 19:52:30 +0100
committerAnoop C S <anoopcs@cryptolab.net>2024-11-29 20:00:28 +0100
commitd2386e80bb25bd70c864c0954ce84718019ab955 (patch)
tree80557a9d794827add7781a0ad646c04e0e53fc10
parentMerge pull request #60560 from ivoalmeida/carbon-tree-component (diff)
downloadceph-d2386e80bb25bd70c864c0954ce84718019ab955.tar.xz
ceph-d2386e80bb25bd70c864c0954ce84718019ab955.zip
mds: Fix invalid access of mdr->dn[0].back()
See https://github.com/ceph/ceph/pull/31534 for a similar fix. Fixes: https://tracker.ceph.com/issues/69059 Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
-rw-r--r--src/mds/Server.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mds/Server.cc b/src/mds/Server.cc
index 5874a3dce56..e66b5aa08c7 100644
--- a/src/mds/Server.cc
+++ b/src/mds/Server.cc
@@ -4167,7 +4167,7 @@ void Server::handle_client_getattr(const MDRequestRef& mdr, bool is_lookup)
if (r < 0) {
// fall-thru. let rdlock_path_pin_ref() check again.
- } else if (is_lookup) {
+ } else if (is_lookup && mdr->dn[0].size()) {
CDentry* dn = mdr->dn[0].back();
mdr->pin(dn);
auto em = dn->batch_ops.emplace(std::piecewise_construct, std::forward_as_tuple(mask), std::forward_as_tuple());
@@ -4274,7 +4274,7 @@ void Server::handle_client_getattr(const MDRequestRef& mdr, bool is_lookup)
// reply
dout(10) << "reply to stat on " << *req << dendl;
mdr->tracei = ref;
- if (is_lookup)
+ if (is_lookup && mdr->dn[0].size())
mdr->tracedn = mdr->dn[0].back();
respond_to_request(mdr, 0);
}