Merge "msm: ipa: Protect ipa default routing table"

This commit is contained in:
Linux Build Service Account 2018-10-10 08:55:41 -07:00 committed by Gerrit - the friendly Code Review server
commit ecee0eb12c

View file

@ -1047,13 +1047,12 @@ static int __ipa_add_rt_rule(enum ipa_ip_type ip, const char *name,
goto error;
}
/*
* do not allow any rules to be added at end of the "default" routing
* tables
* do not allow any rule to be added at "default" routing
* table
*/
if (!strcmp(tbl->name, IPA_DFLT_RT_TBL_NAME) &&
(tbl->rule_cnt > 0) && (at_rear != 0)) {
IPAERR_RL("cannot add rule at end of tbl rule_cnt=%d at_rear=%d"
, tbl->rule_cnt, at_rear);
(tbl->rule_cnt > 0)) {
IPAERR_RL("cannot add rules to default rt table\n");
goto error;
}
@ -1275,13 +1274,12 @@ int ipa3_add_rt_rule_after(struct ipa_ioc_add_rt_rule_after *rules)
}
/*
* do not allow any rules to be added at end of the "default" routing
* tables
* do not allow any rule to be added at "default" routing
* table
*/
if (!strcmp(tbl->name, IPA_DFLT_RT_TBL_NAME) &&
(&entry->link == tbl->head_rt_rule_list.prev)) {
IPAERR_RL("cannot add rule at end of tbl rule_cnt=%d\n",
tbl->rule_cnt);
(tbl->rule_cnt > 0)) {
IPAERR_RL("cannot add rules to default rt table\n");
ret = -EINVAL;
goto bail;
}
@ -1740,6 +1738,10 @@ static int __ipa_mdfy_rt_rule(struct ipa_rt_rule_mdfy *rtrule)
goto error;
}
if (!strcmp(entry->tbl->name, IPA_DFLT_RT_TBL_NAME)) {
IPAERR_RL("Default tbl rule cannot be modified\n");
return -EINVAL;
}
/* Adding check to confirm still
* header entry present in header table or not
*/