From: Sebastien Buisson Date: Mon, 8 Jan 2018 14:28:27 +0000 (+0900) Subject: LU-10454 mdd: check return value of lu_ucred() X-Git-Tag: 2.10.58~86 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=45b3c7a05aac591b6b339bece4ff48306b29f00f;p=fs%2Flustre-release.git LU-10454 mdd: check return value of lu_ucred() In mdd_changelog_data_store_by_fid() part of the function checked for the return value of lu_ucred(), part of it did not. This lead to NULL pointer dereferencing. Signed-off-by: Quentin Bouget Signed-off-by: Sebastien Buisson Change-Id: Iefe9d10191e499aec94415fb6fe0d5d2064f86f0 Reviewed-on: https://review.whamcloud.com/30707 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Li Xi Reviewed-by: Andreas Dilger --- diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index b15e8b4..e421b08 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -1105,16 +1105,17 @@ int mdd_changelog_ns_store(const struct lu_env *env, crf &= CLF_FLAGMASK; crf |= CLF_EXTRA_FLAGS; - if (uc != NULL && uc->uc_jobid[0] != '\0') - crf |= CLF_JOBID; + if (uc) { + if (uc->uc_jobid[0] != '\0') + crf |= CLF_JOBID; + xflags |= CLFE_UIDGID; + } if (sname != NULL) crf |= CLF_RENAME; else crf |= CLF_VERSION; - xflags |= CLFE_UIDGID; - rec->cr.cr_flags = crf; if (crf & CLF_EXTRA_FLAGS) { diff --git a/lustre/mdd/mdd_object.c b/lustre/mdd/mdd_object.c index d8fd430..280a756 100644 --- a/lustre/mdd/mdd_object.c +++ b/lustre/mdd/mdd_object.c @@ -647,10 +647,12 @@ static int mdd_changelog_data_store_by_fid(const struct lu_env *env, int rc; flags = (flags & CLF_FLAGMASK) | CLF_VERSION | CLF_EXTRA_FLAGS; - if (uc != NULL && uc->uc_jobid[0] != '\0') - flags |= CLF_JOBID; - xflags |= CLFE_UIDGID; + if (uc) { + if (uc->uc_jobid[0] != '\0') + flags |= CLF_JOBID; + xflags |= CLFE_UIDGID; + } reclen = llog_data_len(LLOG_CHANGELOG_HDR_SZ + changelog_rec_offset(flags & CLF_SUPPORTED,