From bb9597e8828793f6933ac97cf3b6c031b7c2901b Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Mon, 11 Aug 2014 21:53:01 -0400 Subject: [PATCH] Unionfs: fix d_revalidate for corner case In some cases, lower_dentry may goes to NULL. Return 0 here to mark it as invalid dentry. Signed-off-by: Erez Zadok Signed-off-by: Mengyang Li --- fs/unionfs/dentry.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c index 8624819b651..5f0c57a63f3 100644 --- a/fs/unionfs/dentry.c +++ b/fs/unionfs/dentry.c @@ -310,6 +310,11 @@ static int unionfs_d_revalidate(struct dentry *dentry, unsigned int flags) parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT); unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD); + if (!unionfs_lower_dentry(dentry)) { + err = 0; + goto out; + } + valid = __unionfs_d_revalidate(dentry, parent, false, flags); if (valid) { unionfs_postcopyup_setmnt(dentry); @@ -318,6 +323,7 @@ static int unionfs_d_revalidate(struct dentry *dentry, unsigned int flags) d_drop(dentry); err = valid; } +out: unionfs_unlock_dentry(dentry); unionfs_unlock_parent(dentry, parent); unionfs_read_unlock(dentry->d_sb); -- 2.43.0