]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: Fix invalid access of mdr->dn[0].back() 61450/head
authorAnoop C S <anoopcs@cryptolab.net>
Fri, 29 Nov 2024 18:52:30 +0000 (00:22 +0530)
committerAnoop C S <anoopcs@cryptolab.net>
Mon, 20 Jan 2025 06:34:42 +0000 (12:04 +0530)
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>
(cherry picked from commit d2386e80bb25bd70c864c0954ce84718019ab955)

src/mds/Server.cc

index 6e429f7dc242f36ba9da47b2dc261376bc7f41b9..28758c65240493fd05a8ea656b8af6c71101da3b 100644 (file)
@@ -4073,7 +4073,7 @@ void Server::handle_client_getattr(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());
@@ -4179,7 +4179,7 @@ void Server::handle_client_getattr(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);
 }