Skip to content

Commit a7a2830

Browse files
Quentin CasasnovasJiri Slaby
authored andcommitted
regmap: fix kernel hang on regmap_bulk_write with zero val_count.
If val_count is zero we return -EINVAL with map->lock_arg locked, which will deadlock the kernel next time we try to acquire this lock. In 3.12, this was introduced by a0b8d8d ("regmap: fix possible ZERO_SIZE_PTR pointer dereferencing error.") which improperly back-ported d6b41cb. This issue was found during review of Ubuntu Trusty 3.13.0-40.68 kernel to prepare Ksplice rebootless updates. Fixes: f5942dd ("regmap: fix possible ZERO_SIZE_PTR pointer dereferencing error.") Signed-off-by: Quentin Casasnovas <quentin.casasnovas@oracle.com> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
1 parent cb06484 commit a7a2830

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎drivers/base/regmap/regmap.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,8 +1403,10 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
14031403
if (val_bytes == 1) {
14041404
wval = (void *)val;
14051405
} else {
1406-
if (!val_count)
1407-
return -EINVAL;
1406+
if (!val_count) {
1407+
ret = -EINVAL;
1408+
goto out;
1409+
}
14081410

14091411
wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL);
14101412
if (!wval) {

0 commit comments

Comments
 (0)