regmap: cache: bail in regmap_async_complete() for bus-less maps
authorDaniel Mack <zonque@gmail.com>
Thu, 4 Jul 2013 11:11:03 +0000 (13:11 +0200)
committerMark Brown <broonie@linaro.org>
Thu, 4 Jul 2013 12:54:44 +0000 (13:54 +0100)
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.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: stable@vger.kernel.org [v3.10 only]
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/base/regmap/regmap.c

index a941dcfe7590119f7f1cc1b4a69574ea3d47b9b6..d0c81d1f409c07bf2bb4eac3f34469a7b9626dd9 100644 (file)
@@ -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);