From 1da4cc47d54330ad47180088f9e526417c8567c8 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Thu, 20 Jun 2013 17:42:09 -0500 Subject: [PATCH] LU-3483 llite: Null deref in ll_revalidate_nd on NFSmount 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 Change-Id: I2b5d1718721f76943c3998f359dc83ad3a1590e6 Reviewed-on: http://review.whamcloud.com/6715 Reviewed-by: Keith Mannthey Tested-by: Hudson Reviewed-by: Nathaniel Clark Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/llite/dcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 0152192..9f57ed8 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -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 -- 1.8.3.1