From 09cbd2197e9291d6a3d3f42873f06ca1f388c1a4 Mon Sep 17 00:00:00 2001 From: WANG Chao Date: Thu, 18 Apr 2019 03:41:14 +0000 Subject: RAS/CEC: Increment cec_entered under the mutex lock Modify ->cec_entered in the critical section of the mutex. Signed-off-by: WANG Chao Signed-off-by: Borislav Petkov Cc: Tony Luck Cc: linux-edac Link: https://lkml.kernel.org/r/20190418034115.75954-2-chao.wang@ucloud.cn --- drivers/ras/cec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/ras') 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)); -- cgit v1.2.3-58-ga151