From patchwork Thu Nov 19 21:05:45 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: add check for nameidata before accessing it Date: Thu, 19 Nov 2009 11:05:45 -0000 From: Shirish Pargaonkar X-Patchwork-Id: 38873 Message-Id: <4a4634330911191305q69e98671qfa4089592cdd71cf@mail.gmail.com> To: linux-cifs-client@lists.samba.org This should prevent oops reported in kernel bugzilla 14641 >From 240f75430dbe4965f79d903309488ebabd3d3625 Mon Sep 17 00:00:00 2001 From: Shirish Pargaonkar Date: Thu, 19 Nov 2009 14:38:59 -0600 Subject: [PATCH] add check for nameidata before accessing it Cc: Stable Acked-by: Jeff Layton --- fs/cifs/dir.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) } @@ -675,7 +675,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, * reduction in network traffic in the other paths. */ if (pTcon->unix_ext) { - if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) && + if (nd && !(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) && (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open && (nd->intent.open.flags & O_CREAT)) { rc = cifs_posix_open(full_path, &newInode, nd->path.mnt, -- 1.6.0.2 diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 627a60a..32771f5 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -643,7 +643,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, * O_EXCL: optimize away the lookup, but don't hash the dentry. Let * the VFS handle the create. */ - if (nd->flags & LOOKUP_EXCL) { + if (nd && (nd->flags & LOOKUP_EXCL)) { d_instantiate(direntry, NULL); return 0;