You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
+2
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user