Skip to content
Commit b1cd1b65 authored by Brooke Basile's avatar Brooke Basile Committed by Greg Kroah-Hartman
Browse files

USB: gadget: u_f: add overflow checks to VLA macros



size can potentially hold an overflowed value if its assigned expression
is left unchecked, leading to a smaller than needed allocation when
vla_group_size() is used by callers to allocate memory.
To fix this, add a test for saturation before declaring variables and an
overflow check to (n) * sizeof(type).
If the expression results in overflow, vla_group_size() will return SIZE_MAX.

Reported-by: default avatarIlja Van Sprundel <ivansprundel@ioactive.com>
Suggested-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarBrooke Basile <brookebasile@gmail.com>
Acked-by: default avatarFelipe Balbi <balbi@kernel.org>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f1ec7ae6
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