From: Sebastien Buisson Date: Mon, 7 Mar 2016 23:10:18 +0000 (-0500) Subject: staging: lustre: fix 'data race condition' issue in conrpc.c X-Git-Tag: v4.6-rc1~103^2~275 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c206f8bc543858ed2d82b1547c1a986dbd3df022;p=platform%2Fkernel%2Flinux-exynos.git staging: lustre: fix 'data race condition' issue in conrpc.c Fix 'data race condition' defects found by Coverity version 6.5.0: Data race condition (MISSING_LOCK) Accessing variable without holding lock. Elsewhere, this variable is accessed with lock held. Signed-off-by: Sebastien Buisson Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744 Reviewed-on: http://review.whamcloud.com/6567 Reviewed-by: Liang Zhen Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index e6376a0..8a67f89 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -945,8 +945,12 @@ lstcon_sesnew_stat_reply(lstcon_rpc_trans_t *trans, return status; if (!trans->tas_feats_updated) { - trans->tas_feats_updated = 1; - trans->tas_features = reply->msg_ses_feats; + spin_lock(&console_session.ses_rpc_lock); + if (!trans->tas_feats_updated) { /* recheck with lock */ + trans->tas_feats_updated = 1; + trans->tas_features = reply->msg_ses_feats; + } + spin_unlock(&console_session.ses_rpc_lock); } if (reply->msg_ses_feats != trans->tas_features) {