summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSage Weil2010-12-17 18:53:41 +0100
committerSage Weil2010-12-17 18:53:48 +0100
commit92cf765237e2787eb168096305c448caf25ac7f8 (patch)
tree089f6d5a0f979ca858295cbf616ee2e85a62680f
parentceph: fix direct-io on non-page-aligned buffers (diff)
downloadkernel-qcow2-linux-92cf765237e2787eb168096305c448caf25ac7f8.tar.gz
kernel-qcow2-linux-92cf765237e2787eb168096305c448caf25ac7f8.tar.xz
kernel-qcow2-linux-92cf765237e2787eb168096305c448caf25ac7f8.zip
ceph: fix null pointer dereference in ceph_init_dentry for nfs reexport
The fh_to_dentry etc. methods use ceph_init_dentry(), which assumes that d_parent is defined. It isn't for those callers, so check! Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r--fs/ceph/dir.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 158c700fdca5..d902948a90d8 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -40,7 +40,8 @@ int ceph_init_dentry(struct dentry *dentry)
if (dentry->d_fsdata)
return 0;
- if (ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP)
+ if (dentry->d_parent == NULL || /* nfs fh_to_dentry */
+ ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP)
dentry->d_op = &ceph_dentry_ops;
else if (ceph_snap(dentry->d_parent->d_inode) == CEPH_SNAPDIR)
dentry->d_op = &ceph_snapdir_dentry_ops;