From c87788b69b82abaa9202e624d255033a0c5766b4 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Tue, 14 May 2013 19:02:20 +0200 Subject: [PATCH] mds/Server.cc: fix possible NULL pointer dereference Assert if destdn == NULL. CID 1019557 (#1 of 1): Dereference after null check (FORWARD_NULL) var_deref_model: Passing null pointer "destdn" to function "CDentry::get_dir() const", which dereferences it. Signed-off-by: Danny Al-Gaaf --- src/mds/Server.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index c9fac424f6f80..3e89156cd93d5 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -7091,8 +7091,10 @@ void Server::_rename_rollback_finish(Mutation *mut, MDRequest *mdr, CDentry *src if (srcdn) { CInode *in = srcdn->get_linkage()->get_inode(); // update subtree map? - if (in && in->is_dir()) + if (in && in->is_dir()) { + assert(destdn); mdcache->adjust_subtree_after_rename(in, destdn->get_dir(), true); + } } if (destdn) { -- 2.39.5