diff options
author | Swapnil Pimpale <spimpale@ddn.com> | 2014-02-09 02:51:46 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-11 12:09:57 -0800 |
commit | 7486bc06ab2c46d6957f0211d09bc549aaf9cc87 (patch) | |
tree | 2d3c4ffe4b1cbe78ca86a92269ef9ec93b6b6614 /drivers/staging/lustre/lustre/llite/statahead.c | |
parent | lustre/lov: avoid subobj's coh_parent race (diff) | |
download | linux-dev-7486bc06ab2c46d6957f0211d09bc549aaf9cc87.tar.xz linux-dev-7486bc06ab2c46d6957f0211d09bc549aaf9cc87.zip |
lustre: Unsafe error handling around ll_splice_alias
Callers of ll_splice_alias() should not assign the returned pointer to
the dentry since it can be an err pointer. Fixed the above bug using a
temporary dentry pointer. This temporary pointer is assigned to dentry
only if ll_splice_alias has not returned an err pointer.
Signed-off-by: Swapnil Pimpale <spimpale@ddn.com>
Reviewed-on: http://review.whamcloud.com/7460
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3807
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lustre/llite/statahead.c')
-rw-r--r-- | drivers/staging/lustre/lustre/llite/statahead.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index 183b4157a7d8..ad61ad446f22 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -1585,12 +1585,15 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, ll_inode2fid(inode), &bits); if (rc == 1) { if ((*dentryp)->d_inode == NULL) { - *dentryp = ll_splice_alias(inode, + struct dentry *alias; + + alias = ll_splice_alias(inode, *dentryp); - if (IS_ERR(*dentryp)) { + if (IS_ERR(alias)) { ll_sai_unplug(sai, entry); - return PTR_ERR(*dentryp); + return PTR_ERR(alias); } + *dentryp = alias; } else if ((*dentryp)->d_inode != inode) { /* revalidate, but inode is recreated */ CDEBUG(D_READA, |