From: Danny Al-Gaaf Date: Fri, 17 May 2013 12:38:24 +0000 (+0200) Subject: mds/Server.cc: fix possible NULL pointer dereference X-Git-Tag: v0.64~73^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c266d7c7d4e32b609ef2db474da809eb8a37e7e0;p=ceph.git mds/Server.cc: fix possible NULL pointer dereference Add asserts to solve these CID issues: CID 717002 (#1 of 2): Dereference null return value (NULL_RETURNS) dereference: Dereferencing a pointer that might be null "dir" when calling "CDir::lookup(std::string const &, snapid_t)". CID 717002 (#2 of 2): Dereference null return value (NULL_RETURNS) dereference: Dereferencing a pointer that might be null "dir" when calling "CDir::lookup(std::string const &, snapid_t)". CID 717003 (#1 of 2): Dereference null return value (NULL_RETURNS) dereference: Dereferencing a pointer that might be null "dn" when calling "operator <<(std::ostream &, CDentry &)" CID 717003 (#2 of 2): Dereference null return value (NULL_RETURNS) dereference: Dereferencing a pointer that might be null "straydn" when calling "CDentry::push_projected_linkage()". Signed-off-by: Danny Al-Gaaf --- diff --git a/src/mds/Server.cc b/src/mds/Server.cc index b526b5e036ae..7889a2cb73cd 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -5343,10 +5343,14 @@ void Server::do_rmdir_rollback(bufferlist &rbl, int master, MDRequest *mdr) assert(mdr || mds->is_resolve()); CDir *dir = mds->mdcache->get_dirfrag(rollback.src_dir); + assert(dir); CDentry *dn = dir->lookup(rollback.src_dname); + assert(dn); dout(10) << " dn " << *dn << dendl; dir = mds->mdcache->get_dirfrag(rollback.dest_dir); + assert(dir); CDentry *straydn = dir->lookup(rollback.dest_dname); + assert(straydn); dout(10) << " straydn " << *dn << dendl; CInode *in = straydn->get_linkage()->get_inode();