Skip to contentSkip to conversation

regmap: cache: bail in regmap_async_complete() for bus-less maps

PATCH Applied Daniel Mack 2 participants 2 messages Jul 4, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regmap: cache: bail in regmap_async_complete() for bus-less maps

Commit f8bd822cb ("regmap: cache: Factor out block sync") made regcache_rbtree_sync() call regmap_async_complete(), which in turn does not check for map->bus before dereferencing it.

This causes a NULL pointer dereference on bus-less maps.

---
 drivers/base/regmap/regmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap.c +1 -1
index a941dcf..d0c81d1 100644
@@ -1717,7 +1717,7 @@ int regmap_async_complete(struct regmap *map)
 	int ret;
 
 	/* Nothing to do with no async support */
-	if (!map->bus->async_write)
+	if (!map->bus || !map->bus->async_write)
 		return 0;
 
 	trace_regmap_async_complete_start(map->dev);
Signature · 1 line
1.8.1.4
maintainer Applied
#1 lore raw
Quoted 3 lines · Daniel Mack

Commit f8bd822cb ("regmap: cache: Factor out block sync") made regcache_rbtree_sync() call regmap_async_complete(), which in turn does not check for map->bus before dereferencing it.

Applied, thanks.