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: <20230310073911.3470892-1-alexander.stein@ew.tq-group.com>
Date:   Fri, 10 Mar 2023 08:39:10 +0100
From:   Alexander Stein <alexander.stein@...tq-group.com>
To:     Mark Brown <broonie@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J . Wysocki" <rafael@...nel.org>
Cc:     Alexander Stein <alexander.stein@...tq-group.com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] regmap: cache: Do not panic for REGCACHE_NONE regmap

Most regcache operations do check for REGCACHE_NONE, before ensuring
doing BUG_ON(!map->cache_ops). The missing regcache_sync* functions
panic on REGCACHE_NONE regmaps instead. Add an early return for non-cached
ones.

Signed-off-by: Alexander Stein <alexander.stein@...tq-group.com>
---
 drivers/base/regmap/regcache.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 362e043e26d8..b61763dbfc68 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -349,6 +349,9 @@ int regcache_sync(struct regmap *map)
 	const char *name;
 	bool bypass;
 
+	if (map->cache_type == REGCACHE_NONE)
+		return 0;
+
 	BUG_ON(!map->cache_ops);
 
 	map->lock(map->lock_arg);
@@ -418,6 +421,9 @@ int regcache_sync_region(struct regmap *map, unsigned int min,
 	const char *name;
 	bool bypass;
 
+	if (map->cache_type == REGCACHE_NONE)
+		return 0;
+
 	BUG_ON(!map->cache_ops);
 
 	map->lock(map->lock_arg);
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ