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]
Date:   Fri,  3 Nov 2017 20:08:50 +0000
From:   Mark Brown <broonie@...nel.org>
To:     Baolin Wang <baolin.wang@...aro.org>
Cc:     linux-kernel@...r.kernel.org, Mark Brown <broonie@...nel.org>
Subject: [PATCH 1/2] regmap: Also protect hwspinlock in error handling path

The previous patch to allow the hwspinlock code to be disabled missed
handling the free in the error path, do so using the better IS_ENABLED()
pattern as suggested by Baolin. While we're at it also check that we have
a hardware spinlock before freeing it - the core code reports an error
when freeing an invalid lock.

Suggested-by: Baolin Wang <baolin.wang@...aro.org>
Signed-off-by: Mark Brown <broonie@...nel.org>
---
 drivers/base/regmap/regmap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index ff6ef6a579c6..5ff549fa880b 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1116,7 +1116,8 @@ struct regmap *__regmap_init(struct device *dev,
 	regmap_range_exit(map);
 	kfree(map->work_buf);
 err_hwlock:
-	hwspin_lock_free(map->hwlock);
+	if (IS_ENABLED(REGMAP_HWSPINLOCK) && map->hwlock)
+		hwspin_lock_free(map->hwlock);
 err_map:
 	kfree(map);
 err:
-- 
2.15.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ