From: Yan, Zheng Date: Fri, 4 Apr 2014 12:50:41 +0000 (+0800) Subject: client: fix null pointer dereference in Client::unlink X-Git-Tag: v0.80-rc1~85^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=d12167812bdebb40b2a62f78654fb40789b1653b;p=ceph.git client: fix null pointer dereference in Client::unlink Signed-off-by: Yan, Zheng --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 7623e173ccec4..51e9cd0cadfb1 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -758,7 +758,7 @@ Dentry *Client::insert_dentry_inode(Dir *dir, const string& dname, LeaseStat *dl if (!dn || dn->inode == 0) { in->get(); - if (old_dentry) + if (old_dentry && old_dentry->dir) unlink(old_dentry, dir == old_dentry->dir); // keep dir open if its the same dir dn = link(dir, dname, in, dn); put_inode(in);