msm: ipa3: Fix to validate the NAT table entries during NAT table init

During NAT table Initialization parameter pass from HLOS, if max/zero
table entries passed it was leading to out of bound read. Adding checks
to validate the table entries before passing to NAT table parameter.

Signed-off-by: Himansu Nayak <quic_himansu@quicinc.com>
This commit is contained in:
Himansu Nayak 2022-01-31 08:07:32 +05:30
commit fd9586ccaf

View file

@ -1366,8 +1366,9 @@ int ipa3_nat_init_cmd(
goto bail;
}
if (init->table_entries == 0) {
IPAERR_RL("Table entries is zero\n");
if (init->table_entries == 0 ||
init->table_entries == U16_MAX) {
IPAERR_RL("Table entries is %d\n", init->table_entries);
result = -EPERM;
goto bail;
}