[PATCH] NFS: fix potential NULL deref in nfs_closedir()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Byoungyoung Lee <lifeasageek@xxxxxxxxx>

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@xxxxxxxxx>
Signed-off-by: Taesoo Kim <tsgatesv@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux