mds/Server.cc: fix possible NULL pointer dereference

Assert if straydn is NULL.

CID 1019554 (#2 of 2): Dereference after null check (FORWARD_NULL)
  var_deref_model: Passing null pointer "straydn" to function
  "MDSCacheObject::is_auth() const", which dereferences it.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This commit is contained in:
Danny Al-Gaaf 2013-05-14 19:15:23 +02:00
parent fb222a0a1c
commit d69290219d

View File

@ -6210,9 +6210,12 @@ void Server::_rename_prepare(MDRequest *mdr,
// guarantee stray dir is processed first during journal replay. unlink the old inode,
// then link the source inode to destdn
if (destdnl->is_primary() && straydn->is_auth()) {
metablob->add_dir_context(straydn->get_dir());
metablob->add_dir(straydn->get_dir(), true);
if (destdnl->is_primary()) {
assert(straydn);
if (straydn->is_auth()) {
metablob->add_dir_context(straydn->get_dir());
metablob->add_dir(straydn->get_dir(), true);
}
}
// sub off target