From: Steve French Date: Tue, 24 Nov 2009 22:17:59 +0000 (+0000) Subject: CIFS: fix oops in cifs_lookup during net boot X-Git-Tag: v2.6.31.7~118 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fbad7ae3c0d00c5e5f5951b1de5ef536dec2a5e;p=thirdparty%2Fkernel%2Fstable.git CIFS: fix oops in cifs_lookup during net boot commit 8e6c0332d5032aef2d3bc8f41771f999112c8c66 upstream. Fixes bugzilla.kernel.org bug number 14641 Lookup called during network boot (network root filesystem for diskless workstation) has case where nd is null in lookup. This patch fixes that in cifs_lookup. (Shirish noted that 2.6.30 and 2.6.31 stable need the same check) Signed-off-by: Shirish Pargaonkar Acked-by: Jeff Layton Tested-by: Vladimir Stavrinov Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 4326ffd90fa91..68ef889fc873e 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -648,7 +648,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; } @@ -680,7 +680,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,