Commit 3465e6b4 authored by Quentin Casasnovas's avatar Quentin Casasnovas Committed by Sasha Levin

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 a0b8d8d9
("regmap: fix possible ZERO_SIZE_PTR pointer dereferencing error.")
which improperly back-ported d6b41cb0.

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: default avatarQuentin Casasnovas <quentin.casasnovas@oracle.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
(cherry picked from commit a7a2830c)

(cherry picked from commit HEAD)
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 23de8dab
......@@ -1129,8 +1129,10 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
if (val_bytes == 1) {
wval = (void *)val;
} else {
if (!val_count)
return -EINVAL;
if (!val_count) {
ret = -EINVAL;
goto out;
}
if (!val_count)
return -EINVAL;
......
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