From b66475c7935b2029d3e6e94e74458b6a3e22b6e2 Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Fri, 24 Sep 2010 02:21:08 -0400 Subject: [PATCH] Unionfs: run check_nd only if nd is valid in ->put_link Signed-off-by: Erez Zadok --- fs/unionfs/debug.c | 1 - fs/unionfs/inode.c | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c index acc44bd70e2..100d2c625c3 100644 --- a/fs/unionfs/debug.c +++ b/fs/unionfs/debug.c @@ -438,7 +438,6 @@ void __unionfs_check_nd(const struct nameidata *nd, PRINT_CALLER(fname, fxn, line); pr_debug(" CND1: lower_file of type %s\n", file->f_path.dentry->d_sb->s_type->name); - BUG(); } } } diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c index 062163a9e96..4c36f16b4d2 100644 --- a/fs/unionfs/inode.c +++ b/fs/unionfs/inode.c @@ -716,6 +716,7 @@ static void unionfs_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) { struct dentry *parent; + char *buf; unionfs_read_lock(dentry->d_sb, UNIONFS_SMUTEX_CHILD); parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT); @@ -726,8 +727,13 @@ static void unionfs_put_link(struct dentry *dentry, struct nameidata *nd, "unionfs: put_link failed to revalidate dentry\n"); unionfs_check_dentry(dentry); +#if 0 + /* XXX: can't run this check b/c this fxn can receive a poisoned 'nd' PTR */ unionfs_check_nd(nd); - kfree(nd_get_link(nd)); +#endif + buf = nd_get_link(nd); + if (!IS_ERR(buf)) + kfree(buf); unionfs_unlock_dentry(dentry); unionfs_unlock_parent(dentry, parent); unionfs_read_unlock(dentry->d_sb); -- 2.34.1