From: Danny Al-Gaaf Date: Sat, 10 May 2014 22:36:20 +0000 (+0200) Subject: libcephfs.cc: fix possible NULL pointer deref X-Git-Tag: v0.81~27^2~25 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a121d014610d2dc7aa096d7fdce003b9784e1af0;p=ceph.git libcephfs.cc: fix possible NULL pointer deref Fix possible NULL pointer dereference of 'inode' in ceph_ll_lookup_inode(). It's not enough to check for 'inode' without assert or error handling before assert for '*inode != NULL' since this doesn't handle the 'inode == NULL' case for the later calls. Fix for: 1192 r = (cmount->get_client())->lookup_parent(*inode, &parent); 5 Dereference of null pointer (loaded from variable 'inode') Signed-off-by: Danny Al-Gaaf --- diff --git a/src/libcephfs.cc b/src/libcephfs.cc index 88e86ba83470..9fd050946cc9 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -1183,9 +1183,9 @@ extern "C" int ceph_ll_lookup_inode( if (r) { return r; } - if (inode) { - assert(*inode != NULL); - } + + assert(inode != NULL); + assert(*inode != NULL); // Request the parent inode, so that we can look up the name Inode *parent;