public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Taesoo Kim <tsgatesv@gmail.com>
To: trond.myklebust@primarydata.com, anna.schumaker@netapp.com,
	linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: taesoo@gatech.edu, changwoo@gatech.edu, sanidhya@gatech.edu,
	blee@gatech.edu, csong84@gatech.edu,
	Byoungyoung Lee <lifeasageek@gmail.com>,
	Taesoo Kim <tsgatesv@gmail.com>
Subject: [PATCH] NFS: fix potential NULL deref in nfs_closedir()
Date: Sat, 21 Mar 2015 00:21:18 -0400	[thread overview]
Message-ID: <1426911678-25306-1-git-send-email-tsgatesv@gmail.com> (raw)

From: Byoungyoung Lee <lifeasageek@gmail.com>

When filp->private_data is NULL, put_nfs_open_dir_context()
deferences its pointer (fi->list, fi->cred), similar to what
other file systems handle '.release' api (9p, cifs, btrfs, 
ext4, ocfs2).

Signed-off-by: Byoungyoung Lee <lifeasageek@gmail.com>
Signed-off-by: Taesoo Kim <tsgatesv@gmail.com>
---
 fs/nfs/dir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index c19e16f..434ecf1 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -133,7 +133,8 @@ out:
 static int
 nfs_closedir(struct inode *inode, struct file *filp)
 {
-	put_nfs_open_dir_context(file_inode(filp), filp->private_data);
+	if (filp->private_data)
+		put_nfs_open_dir_context(file_inode(filp), filp->private_data);
 	return 0;
 }
 
-- 
1.9.1


             reply	other threads:[~2015-03-21  4:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-21  4:21 Taesoo Kim [this message]
2015-03-21 18:01 ` [PATCH] NFS: fix potential NULL deref in nfs_closedir() Christoph Hellwig
2015-03-21 18:47   ` Taesoo Kim

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=1426911678-25306-1-git-send-email-tsgatesv@gmail.com \
    --to=tsgatesv@gmail.com \
    --cc=anna.schumaker@netapp.com \
    --cc=blee@gatech.edu \
    --cc=changwoo@gatech.edu \
    --cc=csong84@gatech.edu \
    --cc=lifeasageek@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=sanidhya@gatech.edu \
    --cc=taesoo@gatech.edu \
    --cc=trond.myklebust@primarydata.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox