All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sage Weil <sage@newdream.net>
To: ceph-devel@vger.kernel.org
Cc: Sage Weil <sage@newdream.net>
Subject: [PATCH 3/5] ceph: fix null pointer dereference in ceph_init_dentry for nfs reexport
Date: Mon, 20 Dec 2010 11:15:29 -0800	[thread overview]
Message-ID: <1292872531-18396-4-git-send-email-sage@newdream.net> (raw)
In-Reply-To: <1292872531-18396-3-git-send-email-sage@newdream.net>

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>
---
 fs/ceph/dir.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 158c700..d902948 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;
-- 
1.6.6.1


  reply	other threads:[~2010-12-20 19:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-20 19:15 [PATCH 0/5] pending items for 2.6.37 Sage Weil
2010-12-20 19:15 ` [PATCH 1/5] ceph: fix msgr_init error path Sage Weil
2010-12-20 19:15   ` [PATCH 2/5] ceph: fix direct-io on non-page-aligned buffers Sage Weil
2010-12-20 19:15     ` Sage Weil [this message]
2010-12-20 19:15       ` [PATCH 4/5] ceph: mark user pages dirty on direct-io reads Sage Weil
2010-12-20 19:15         ` [PATCH 5/5] ceph: handle partial result from get_user_pages Sage Weil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1292872531-18396-4-git-send-email-sage@newdream.net \
    --to=sage@newdream.net \
    --cc=ceph-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.