From: Erez Zadok Date: Fri, 24 Sep 2010 06:21:08 +0000 (-0400) Subject: Unionfs: run check_nd only if nd is valid in ->put_link X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=ab9c9f5d900be70eacb244b39365bda234d38896;p=unionfs-3.14.y.git Unionfs: run check_nd only if nd is valid in ->put_link Signed-off-by: Erez Zadok --- diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c index acc44bd70e20..100d2c625c32 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 062163a9e965..4c36f16b4d23 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);