lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151019175554.GB3367@linux-uzut.site>
Date:	Mon, 19 Oct 2015 10:55:54 -0700
From:	Davidlohr Bueso <dave@...olabs.net>
To:	Huang Ying <ying.huang@...el.com>
Cc:	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Borislav Petkov <bp@...e.de>, Tony Luck <tony.luck@...el.com>,
	linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] GHES: Fix cached error-status

In ghes_estatus_cached() we currently have a situation where
we can break out of the loop before examining all the possible
estatus_caches. Move the 'break' statement inside of the 'if',
such that an otherwise possibly missed cache is acknowledged
and the function returns the proper value.

Introduced by 152cef40a808d (ACPI, APEI, GHES, Error records
content based throttle).

Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
---

Hi,

I found this accidentally and have no idea if it is correct, but
seems to be a case of a misplaced break. If this is not the case,
then it is a very weird way of using a for-loop, and should probably
be rewritten -- and there are other funky places in this file...

100% untested.

Thanks,
Davidlohr

  drivers/acpi/apei/ghes.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 3dd9c46..3fda4a2 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -541,9 +541,10 @@ static int ghes_estatus_cached(struct acpi_hest_generic_status *estatus)
  			continue;
  		atomic_inc(&cache->count);
  		now = sched_clock();
-		if (now - cache->time_in < GHES_ESTATUS_IN_CACHE_MAX_NSEC)
+		if (now - cache->time_in < GHES_ESTATUS_IN_CACHE_MAX_NSEC) {
  			cached = 1;
-		break;
+			break;
+		}
  	}
  	rcu_read_unlock();
  	return cached;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ