linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] RAS/CEC: fix __find_elem
@ 2019-04-18  3:41 WANG Chao
  2019-04-18  3:41 ` [PATCH 2/3] RAS/CEC: make ces_entered smp safe WANG Chao
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: WANG Chao @ 2019-04-18  3:41 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: Tony Luck, linux-kernel, linux-edac

A left over pfn (because we don't clear) at ca->array[n] can be a match
in __find_elem. Later it'd cause a memmove size overflow in del_elem.

Signed-off-by: WANG Chao <chao.wang@ucloud.cn>
---
 drivers/ras/cec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index 2d9ec378a8bc..2e0bf1269c31 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -206,7 +206,7 @@ static int __find_elem(struct ce_array *ca, u64 pfn, unsigned int *to)
 
 	this_pfn = PFN(ca->array[min]);
 
-	if (this_pfn == pfn)
+	if (this_pfn == pfn && ca->n > min)
 		return min;
 
 	return -ENOKEY;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-06-08 21:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-18  3:41 [PATCH 1/3] RAS/CEC: fix __find_elem WANG Chao
2019-04-18  3:41 ` [PATCH 2/3] RAS/CEC: make ces_entered smp safe WANG Chao
2019-04-20 10:19   ` [tip:ras/core] RAS/CEC: Increment cec_entered under the mutex lock tip-bot for WANG Chao
2019-04-20 10:22   ` tip-bot for WANG Chao
2019-04-18  3:41 ` [PATCH 3/3] RAS/CEC: immediate soft-offline page when count_threshold == 1 WANG Chao
2019-04-20 11:57   ` Borislav Petkov
2019-04-24  2:43     ` WANG Chao
2019-04-24 10:26       ` Borislav Petkov
2019-06-08 21:26   ` [tip:ras/core] RAS/CEC: Check count_threshold unconditionally tip-bot for Borislav Petkov
2019-04-25  7:56 ` [PATCH 1/3] RAS/CEC: fix __find_elem WANG Chao
2019-04-25  8:05   ` WANG Chao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).