aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammed Javid <mjavid@codeaurora.org>2018-09-21 11:42:40 +0530
committerabel_fang <Abel_Fang@compal.com>2019-01-15 16:12:57 +0800
commit9ab3f97c00bcbe2628ee12604f5d6c5b613bbc76 (patch)
treee3fbc9ea69bc5531ae18f9d3bb5ff07e096d1f9c
parentd1299ad2d226c6a2f3d6593cf91bd25e639e5747 (diff)
msm: ipa: Protect ipa default routing tableandroid-wear-9.0.0_r0.20
Protect ipa default routing table from addition, deletion and modification once after default rule added by ipa-driver. Change-Id: I045d9c29fed23edf796d826e440b81124e1f666a Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
-rw-r--r--drivers/platform/msm/ipa/ipa_v3/ipa_rt.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_rt.c b/drivers/platform/msm/ipa/ipa_v3/ipa_rt.c
index 759610f031ce..9d69c52acfd6 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_rt.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_rt.c
@@ -1207,13 +1207,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;
}
@@ -1436,13 +1435,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;
}
@@ -1891,6 +1889,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
*/