In ceph_dir_set_complete(), the return value of __d_find_any_alias()
is blindly dereferenced.  That function can return a null pointer,
so the dereference needs to be protected by a check for that.

Signed-off-by: Alex Elder <[email protected]>

---
 fs/ceph/dir.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Index: b/fs/ceph/dir.c
===================================================================
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -1115,12 +1115,14 @@ static struct dentry * __d_find_any_alia
 void ceph_dir_set_complete(struct inode *inode)
 {
        struct dentry *dentry = __d_find_any_alias(inode);
-       struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
        
-       if (dentry && ceph_dentry(dentry) &&
-           ceph_test_mount_opt(fsc, USEDCACHE)) {
-               dout(" marking %p (%p) complete\n", inode, dentry);
-               set_bit(CEPH_D_COMPLETE, &ceph_dentry(dentry)->flags);
+       if (dentry && ceph_dentry(dentry)) {
+               struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
+
+               if (ceph_test_mount_opt(fsc, USEDCACHE)) {
+                       dout(" marking %p (%p) complete\n", inode, dentry);
+                       set_bit(CEPH_D_COMPLETE, &ceph_dentry(dentry)->flags);
+               }
        }
 }
 


--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to