Commit 451941ac authored by Mark Brown's avatar Mark Brown

regmap: Fix double unlock in the maple cache

Doing the dance to drop the maple tree's internal spinlock means we need
multiple exit paths in our error handling.
Reported-by: default avatarLiam R. Howlett <Liam.Howlett@Oracle.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230403-regmap-maple-unlock-v1-1-89998991b16c@kernel.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f033c26d
...@@ -137,7 +137,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min, ...@@ -137,7 +137,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
GFP_KERNEL); GFP_KERNEL);
if (!lower) { if (!lower) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out_unlocked;
} }
} }
...@@ -151,7 +151,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min, ...@@ -151,7 +151,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
GFP_KERNEL); GFP_KERNEL);
if (!upper) { if (!upper) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out_unlocked;
} }
} }
...@@ -179,6 +179,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min, ...@@ -179,6 +179,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
out: out:
mas_unlock(&mas); mas_unlock(&mas);
out_unlocked:
kfree(lower); kfree(lower);
kfree(upper); kfree(upper);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment