[linux-cifs-client] [PATCH] add check for nameidata before accessing it

Jeff Layton jlayton at redhat.com
Thu Nov 19 15:12:42 MST 2009


On Thu, 19 Nov 2009 15:05:45 -0600
Shirish Pargaonkar <shirishpargaonkar at gmail.com> wrote:

> This should prevent oops reported in kernel bugzilla 14641
> 
> From 240f75430dbe4965f79d903309488ebabd3d3625 Mon Sep 17 00:00:00 2001
> From: Shirish Pargaonkar <shirishpargaonkar at gmail.com>
> Date: Thu, 19 Nov 2009 14:38:59 -0600
> Subject: [PATCH] add check for nameidata before accessing it
> 
> Cc: Stable <stable at kernel.org>
> ---
>  fs/cifs/dir.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> 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;
>         }
> @@ -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

Once the line-wrapping is fixed...

Acked-by: Jeff Layton <jlayton at redhat.com>


More information about the linux-cifs-client mailing list