From 8283ac89592402893d453b82d058c1d105e8cd63 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 12 Apr 2021 08:22:54 +0200 Subject: [PATCH] 5.10-stable patches added patches: ras-cec-correct-ce_add_elem-s-returned-values.patch --- ...orrect-ce_add_elem-s-returned-values.patch | 60 +++++++++++++++++++ queue-5.10/series | 1 + 2 files changed, 61 insertions(+) create mode 100644 queue-5.10/ras-cec-correct-ce_add_elem-s-returned-values.patch diff --git a/queue-5.10/ras-cec-correct-ce_add_elem-s-returned-values.patch b/queue-5.10/ras-cec-correct-ce_add_elem-s-returned-values.patch new file mode 100644 index 00000000000..8348b2fa95f --- /dev/null +++ b/queue-5.10/ras-cec-correct-ce_add_elem-s-returned-values.patch @@ -0,0 +1,60 @@ +From 3a62583c2853b0ab37a57dde79decea210b5fb89 Mon Sep 17 00:00:00 2001 +From: William Roche +Date: Tue, 6 Apr 2021 11:28:59 -0400 +Subject: RAS/CEC: Correct ce_add_elem()'s returned values + +From: William Roche + +commit 3a62583c2853b0ab37a57dde79decea210b5fb89 upstream. + +ce_add_elem() uses different return values to signal a result from +adding an element to the collector. Commit in Fixes: broke the case +where the element being added is not found in the array. Correct that. + + [ bp: Rewrite commit message, add kernel-doc comments. ] + +Fixes: de0e0624d86f ("RAS/CEC: Check count_threshold unconditionally") +Signed-off-by: William Roche +Signed-off-by: Borislav Petkov +Cc: +Link: https://lkml.kernel.org/r/1617722939-29670-1-git-send-email-william.roche@oracle.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/ras/cec.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +--- a/drivers/ras/cec.c ++++ b/drivers/ras/cec.c +@@ -309,11 +309,20 @@ static bool sanity_check(struct ce_array + return ret; + } + ++/** ++ * cec_add_elem - Add an element to the CEC array. ++ * @pfn: page frame number to insert ++ * ++ * Return values: ++ * - <0: on error ++ * - 0: on success ++ * - >0: when the inserted pfn was offlined ++ */ + static int cec_add_elem(u64 pfn) + { + struct ce_array *ca = &ce_arr; ++ int count, err, ret = 0; + unsigned int to = 0; +- int count, ret = 0; + + /* + * We can be called very early on the identify_cpu() path where we are +@@ -330,8 +339,8 @@ static int cec_add_elem(u64 pfn) + if (ca->n == MAX_ELEMS) + WARN_ON(!del_lru_elem_unlocked(ca)); + +- ret = find_elem(ca, pfn, &to); +- if (ret < 0) { ++ err = find_elem(ca, pfn, &to); ++ if (err < 0) { + /* + * Shift range [to-end] to make room for one more element. + */ diff --git a/queue-5.10/series b/queue-5.10/series index 14c302f4c95..319d9d5d953 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -166,3 +166,4 @@ i40e-fix-parameters-in-aq_get_phy_register.patch rdma-addr-be-strict-with-gid-size.patch vdpa-mlx5-should-exclude-header-length-and-fcs-from-.patch vdpa-mlx5-fix-wrong-use-of-bit-numbers.patch +ras-cec-correct-ce_add_elem-s-returned-values.patch -- 2.47.3