From: James Simmons <jsimmons@infradead.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org,
Andreas Dilger <andreas.dilger@intel.com>,
Oleg Drokin <oleg.drokin@intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Lustre Development List <lustre-devel@lists.lustre.org>,
Sebastien Buisson <sbuisson@ddn.com>
Subject: [PATCH 03/10] staging: lustre: fix 'data race condition' issue in conrpc.c
Date: Fri, 4 Mar 2016 21:09:43 -0500 [thread overview]
Message-ID: <1457143790-19422-4-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1457143790-19422-1-git-send-email-jsimmons@infradead.org>
From: Sebastien Buisson <sbuisson@ddn.com>
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 <sbuisson@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744
Reviewed-on: http://review.whamcloud.com/6567
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
---
drivers/staging/lustre/lnet/selftest/conrpc.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
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) {
--
1.7.1
next prev parent reply other threads:[~2016-03-05 2:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-05 2:09 [PATCH 00/10] Last batch of fixes for LNet James Simmons
2016-03-05 2:09 ` [PATCH 01/10] staging: lustre: LNet drop rule implementation James Simmons
2016-03-05 7:53 ` kbuild test robot
2016-03-05 2:09 ` [PATCH 02/10] staging: lustre: LNet network latency simulation James Simmons
2016-03-05 2:09 ` James Simmons [this message]
2016-03-05 2:09 ` [PATCH 04/10] staging: lustre: fix 'NULL pointer dereference' errors James Simmons
2016-03-05 2:09 ` [PATCH 05/10] staging: lustre: fix 'data race condition' issue in framework.c James Simmons
2016-03-05 2:09 ` [PATCH 06/10] staging: lustre: Correct missing newline James Simmons
2016-03-05 2:09 ` [PATCH 07/10] staging: lustre: add last missing sparse annotation __user James Simmons
2016-03-05 2:55 ` Drokin, Oleg
2016-03-05 2:09 ` [PATCH 08/10] staging: lustre: change test to asser in LNetGetId James Simmons
2016-03-05 2:09 ` [PATCH 09/10] staging: lustre: rename proc_call_handler to lprocfs_call_handler James Simmons
2016-03-05 2:09 ` [PATCH 10/10] staging: lustre: make LNet use lprocfs_call_handler James Simmons
2016-03-05 19:52 ` [PATCH 00/10] Last batch of fixes for LNet Greg Kroah-Hartman
2016-03-07 19:34 ` [lustre-devel] " Simmons, James A.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457143790-19422-4-git-send-email-jsimmons@infradead.org \
--to=jsimmons@infradead.org \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
--cc=oleg.drokin@intel.com \
--cc=sbuisson@ddn.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®