From: Frank Zago Date: Tue, 3 Feb 2015 18:37:00 +0000 (-0600) Subject: LU-5938 mdd: fixed oops when dereferencing structure X-Git-Tag: 2.7.51~89 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=325505601b3a3130d38834990661b79dfd126393;p=fs%2Flustre-release.git LU-5938 mdd: fixed oops when dereferencing structure In mdd_changelog_ns_store() and mdd_changelog_data_store(), lu_ucred(env) can be NULL, so do not dereference it. Signed-off-by: frank zago Change-Id: I45d0cbbb171f05ee1d04e628a3b31c256e0d3951 Reviewed-on: http://review.whamcloud.com/13619 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Henri Doreau Reviewed-by: Faccini Bruno Reviewed-by: Andreas Dilger --- diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index be38034..4532bcd 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -813,9 +813,9 @@ int mdd_changelog_ns_store(const struct lu_env *env, RETURN(-ENOMEM); rec = buf->lb_buf; - crf = (crf & CLF_FLAGMASK); + crf &= CLF_FLAGMASK; - if (uc->uc_jobid[0] != '\0') + if (uc != NULL && uc->uc_jobid[0] != '\0') crf |= CLF_JOBID; if (sname != NULL) diff --git a/lustre/mdd/mdd_object.c b/lustre/mdd/mdd_object.c index 2070d29..30b8dd2 100644 --- a/lustre/mdd/mdd_object.c +++ b/lustre/mdd/mdd_object.c @@ -677,7 +677,7 @@ int mdd_changelog_data_store(const struct lu_env *env, struct mdd_device *mdd, } flags = (flags & CLF_FLAGMASK) | CLF_VERSION; - if (uc->uc_jobid[0] != '\0') + if (uc != NULL && uc->uc_jobid[0] != '\0') flags |= CLF_JOBID; reclen = llog_data_len(changelog_rec_offset(flags & CLF_SUPPORTED));