Skip to content

Commit 451941a

Browse files
committed
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: Liam R. Howlett <Liam.Howlett@Oracle.com> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230403-regmap-maple-unlock-v1-1-89998991b16c@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent f033c26 commit 451941a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/base/regmap/regcache-maple.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
137137
GFP_KERNEL);
138138
if (!lower) {
139139
ret = -ENOMEM;
140-
goto out;
140+
goto out_unlocked;
141141
}
142142
}
143143

@@ -151,7 +151,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
151151
GFP_KERNEL);
152152
if (!upper) {
153153
ret = -ENOMEM;
154-
goto out;
154+
goto out_unlocked;
155155
}
156156
}
157157

@@ -179,6 +179,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
179179

180180
out:
181181
mas_unlock(&mas);
182+
out_unlocked:
182183
kfree(lower);
183184
kfree(upper);
184185

0 commit comments

Comments
 (0)