Commit 7486bc06 authored by Swapnil Pimpale's avatar Swapnil Pimpale Committed by Greg Kroah-Hartman

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: default avatarSwapnil Pimpale <spimpale@ddn.com>
Reviewed-on: http://review.whamcloud.com/7460
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3807Reviewed-by: default avatarFan Yong <fan.yong@intel.com>
Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f34b6cd3
...@@ -462,9 +462,12 @@ int ll_lookup_it_finish(struct ptlrpc_request *request, ...@@ -462,9 +462,12 @@ int ll_lookup_it_finish(struct ptlrpc_request *request,
* Atoimc_open may passin hashed dentries for open. * Atoimc_open may passin hashed dentries for open.
*/ */
if (d_unhashed(*de)) { if (d_unhashed(*de)) {
*de = ll_splice_alias(inode, *de); struct dentry *alias;
if (IS_ERR(*de))
return PTR_ERR(*de); alias = ll_splice_alias(inode, *de);
if (IS_ERR(alias))
return PTR_ERR(alias);
*de = alias;
} }
if (!it_disposition(it, DISP_LOOKUP_NEG)) { if (!it_disposition(it, DISP_LOOKUP_NEG)) {
......
...@@ -1585,12 +1585,15 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, ...@@ -1585,12 +1585,15 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,
ll_inode2fid(inode), &bits); ll_inode2fid(inode), &bits);
if (rc == 1) { if (rc == 1) {
if ((*dentryp)->d_inode == NULL) { if ((*dentryp)->d_inode == NULL) {
*dentryp = ll_splice_alias(inode, struct dentry *alias;
alias = ll_splice_alias(inode,
*dentryp); *dentryp);
if (IS_ERR(*dentryp)) { if (IS_ERR(alias)) {
ll_sai_unplug(sai, entry); ll_sai_unplug(sai, entry);
return PTR_ERR(*dentryp); return PTR_ERR(alias);
} }
*dentryp = alias;
} else if ((*dentryp)->d_inode != inode) { } else if ((*dentryp)->d_inode != inode) {
/* revalidate, but inode is recreated */ /* revalidate, but inode is recreated */
CDEBUG(D_READA, CDEBUG(D_READA,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment