regmap: fix kernel hang on regmap_bulk_write with zero val_count.
Fixes commit2f06fa04cf
which was an incorrect backported version of commitd6b41cb060
upstream. 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. This was introduced by f5942dd ("regmap: fix possible ZERO_SIZE_PTR pointer dereferencing error.") which improperly back-portedd6b41cb0
. 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
84efcb2025
commit
197b3975f4
|
@ -1557,8 +1557,10 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
|
|||
} else {
|
||||
void *wval;
|
||||
|
||||
if (!val_count)
|
||||
return -EINVAL;
|
||||
if (!val_count) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL);
|
||||
if (!wval) {
|
||||
|
|
Loading…
Reference in New Issue