msm: ipa3: Add check to validate rule_cnt

Add proper check to validate table rule count
which may lead to overflow error.

Change-Id: I9bdcafcaae4e4cff1b901929c8dc6ae804f85642
Signed-off-by: Praveen Kurapati <pkurapat@codeaurora.org>
tirimbino
Praveen Kurapati 4 years ago committed by Gerrit - the friendly Code Review server
parent 4cc0fd543c
commit c4fd3519f3
  1. 5
      drivers/platform/msm/ipa/ipa_v3/ipa_flt.c
  2. 2
      drivers/platform/msm/ipa/ipa_v3/ipa_i.h
  3. 5
      drivers/platform/msm/ipa/ipa_v3/ipa_rt.c

@ -949,7 +949,10 @@ static int __ipa_finish_flt_rule_add(struct ipa3_flt_tbl *tbl,
{
int id;
tbl->rule_cnt++;
if (tbl->rule_cnt < IPA_RULE_CNT_MAX)
tbl->rule_cnt++;
else
return -EINVAL;
if (entry->rt_tbl)
entry->rt_tbl->ref_cnt++;
id = ipa3_id_alloc(entry);

@ -469,6 +469,8 @@ enum {
#define MBOX_TOUT_MS 100
#define IPA_RULE_CNT_MAX 512
struct ipa3_active_client_htable_entry {
struct hlist_node list;
char id_string[IPA3_ACTIVE_CLIENTS_LOG_NAME_LEN];

@ -1087,7 +1087,10 @@ static int __ipa_finish_rt_rule_add(struct ipa3_rt_entry *entry, u32 *rule_hdl,
{
int id;
tbl->rule_cnt++;
if (tbl->rule_cnt < IPA_RULE_CNT_MAX)
tbl->rule_cnt++;
else
return -EINVAL;
if (entry->hdr)
entry->hdr->ref_cnt++;
else if (entry->proc_ctx)

Loading…
Cancel
Save