summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWANG Chao <chao.wang@ucloud.cn>2019-04-18 06:41:14 +0300
committerBorislav Petkov <bp@suse.de>2019-04-20 13:16:52 +0300
commit09cbd2197e9291d6a3d3f42873f06ca1f388c1a4 (patch)
tree5626f4de88e0d5341a7b9d86f4aa5d16d226c50f
parent28156d7678431312b463361b23a218a1b5645ba5 (diff)
downloadlinux-09cbd2197e9291d6a3d3f42873f06ca1f388c1a4.tar.xz
RAS/CEC: Increment cec_entered under the mutex lock
Modify ->cec_entered in the critical section of the mutex. Signed-off-by: WANG Chao <chao.wang@ucloud.cn> Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Tony Luck <tony.luck@intel.com> Cc: linux-edac <linux-edac@vger.kernel.org> Link: https://lkml.kernel.org/r/20190418034115.75954-2-chao.wang@ucloud.cn
-rw-r--r--drivers/ras/cec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index 2d9ec378a8bc..88e4f3ff0cb8 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -286,10 +286,10 @@ int cec_add_elem(u64 pfn)
if (!ce_arr.array || ce_arr.disabled)
return -ENODEV;
- ca->ces_entered++;
-
mutex_lock(&ce_mutex);
+ ca->ces_entered++;
+
if (ca->n == MAX_ELEMS)
WARN_ON(!del_lru_elem_unlocked(ca));