From: Li Xi Date: Fri, 7 Mar 2014 04:32:12 +0000 (+0800) Subject: LU-4728 mdt: fix NULL deference of mdt_fid_lock X-Git-Tag: 2.5.57~6 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F43%2F9543%2F2;p=fs%2Flustre-release.git LU-4728 mdt: fix NULL deference of mdt_fid_lock When enabling hsm_control, mti_exp field of struct mdt_thread_info could be NULL. ldlm_cli_enqueue_local will crash the kernel when dereference it. Signed-off-by: Li Xi Change-Id: I4bdb8222aec378e396e7f544834f6fcf9fdaf777 Reviewed-on: http://review.whamcloud.com/9543 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Faccini Bruno Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index efe4614..669d778 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -2393,9 +2393,10 @@ static int mdt_object_local_lock(struct mdt_thread_info *info, * want it slowed down due to possible cancels. */ policy->l_inodebits.bits = MDS_INODELOCK_UPDATE; - rc = mdt_fid_lock(ns, &lh->mlh_pdo_lh, lh->mlh_pdo_mode, - policy, res_id, dlmflags, - &info->mti_exp->exp_handle.h_cookie); + rc = mdt_fid_lock(ns, &lh->mlh_pdo_lh, lh->mlh_pdo_mode, + policy, res_id, dlmflags, + info->mti_exp == NULL ? NULL : + &info->mti_exp->exp_handle.h_cookie); if (unlikely(rc)) RETURN(rc); } @@ -2414,9 +2415,10 @@ static int mdt_object_local_lock(struct mdt_thread_info *info, * going to be sent to client. If it is - mdt_intent_policy() path will * fix it up and turn FL_LOCAL flag off. */ - rc = mdt_fid_lock(ns, &lh->mlh_reg_lh, lh->mlh_reg_mode, policy, - res_id, LDLM_FL_LOCAL_ONLY | dlmflags, - &info->mti_exp->exp_handle.h_cookie); + rc = mdt_fid_lock(ns, &lh->mlh_reg_lh, lh->mlh_reg_mode, policy, + res_id, LDLM_FL_LOCAL_ONLY | dlmflags, + info->mti_exp == NULL ? NULL : + &info->mti_exp->exp_handle.h_cookie); if (rc) mdt_object_unlock(info, o, lh, 1); else if (unlikely(OBD_FAIL_PRECHECK(OBD_FAIL_MDS_PDO_LOCK)) &&