Whamcloud - gitweb
LU-3483 llite: Null deref in ll_revalidate_nd on NFSmount 15/6715/5
authorPatrick Farrell <paf@cray.com>
Thu, 20 Jun 2013 22:42:09 +0000 (17:42 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 10 Jul 2013 03:27:04 +0000 (03:27 +0000)
In calls to ll_revalidate_nd, the nameidata pointer nd is
sometimes null.  The core code of the function tests for
this case and handles it by calling ll_node_revalidate_it.
However, immediately before that code, there is a test to
see if the LOOKUP_RCU flag is set in nd->flags.  This test
does NOT check to see if the nd pointer is null.  Per
the comment, LOOKUP_RCU was added in kernel 2.6.38, and
this code is #ifdefed accordingly.
The fix is to test if nd is null in the LOOKUP_RCU check.

Signed-off-by: Patrick Farrell <paf@cray.com>
Change-Id: I2b5d1718721f76943c3998f359dc83ad3a1590e6
Reviewed-on: http://review.whamcloud.com/6715
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Tested-by: Hudson
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/dcache.c

index 0152192..9f57ed8 100644 (file)
@@ -693,7 +693,7 @@ int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
 
 #ifndef HAVE_DCACHE_LOCK
        /* kernel >= 2.6.38 supports rcu-walk, but lustre doesn't. */
-       if (nd->flags & LOOKUP_RCU)
+       if (nd && (nd->flags & LOOKUP_RCU))
                return -ECHILD;
 #endif