]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
libcephfs.cc: fix possible NULL pointer deref
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Sat, 10 May 2014 22:36:20 +0000 (00:36 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Sat, 10 May 2014 22:36:20 +0000 (00:36 +0200)
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 <danny.al-gaaf@bisect.de>
src/libcephfs.cc

index 88e86ba8347068f10d35343b7c63314bc9d3dea0..9fd050946cc926c5855d1be099ba42135df754dc 100644 (file)
@@ -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;