summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2018-05-07 10:54:48 +1000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-08 13:09:21 +0200
commit1d6e65bedf5878c8dd5b089d3f034b619bbb8a77 (patch)
tree10e634988d246c5971090252dc29d7d2b56279cd /drivers
parent9604c7ac2005e214cb08500c957a79c58bea5c83 (diff)
staging: lustre: fix error deref in ll_splice_alias().
d_splice_alias() can return an ERR_PTR(). If it does while debugging is enabled, the following CDEBUG() will dereference that error and crash. So add appropriate checking, and provide a separate debug message for the error case. Reported-and-tested-by: James Simmons <jsimmons@infradead.org> Fixes: e9d4f0b9f559 ("staging: lustre: llite: use d_splice_alias for directories.") Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/lustre/lustre/llite/namei.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
index 6c9ec462eb41..9ac7f097802d 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -442,11 +442,16 @@ struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de)
} else {
struct dentry *new = d_splice_alias(inode, de);
+ if (IS_ERR(new))
+ CDEBUG(D_DENTRY,
+ "splice inode %p as %pd gives error %lu\n",
+ inode, de, PTR_ERR(new));
if (new)
de = new;
}
- CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n",
- de, d_inode(de), d_count(de), de->d_flags);
+ if (!IS_ERR(de))
+ CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n",
+ de, d_inode(de), d_count(de), de->d_flags);
return de;
}