msm: ipa: Prevent deletion of the default route rule

The first APPS default routing table rule is installed
at the IPA driver initialization. To prevent routing
exception, this rule cannot be deleted by user application.
This change prevents deleting this rule.

Change-Id: Ia27434fd24a15fea5956018a1271b11bbe227df7
CRs-fixed: 2165859
Signed-off-by: Ghanim Fodi <gfodi@codeaurora.org>
This commit is contained in:
Ghanim Fodi 2018-01-31 14:49:37 +02:00 committed by Gerrit - the friendly Code Review server
parent f2604c4f48
commit b57f252a8b
2 changed files with 20 additions and 2 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and
@ -1143,6 +1143,15 @@ int __ipa_del_rt_rule(u32 rule_hdl)
return -EINVAL; return -EINVAL;
} }
if (!strcmp(entry->tbl->name, IPA_DFLT_RT_TBL_NAME)) {
IPADBG("Deleting rule from default rt table idx=%u\n",
entry->tbl->idx);
if (entry->tbl->rule_cnt == 1) {
IPAERR_RL("Default tbl last rule cannot be deleted\n");
return -EINVAL;
}
}
if (entry->hdr) if (entry->hdr)
__ipa_release_hdr(entry->hdr->id); __ipa_release_hdr(entry->hdr->id);
else if (entry->proc_ctx) else if (entry->proc_ctx)

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and
@ -1281,6 +1281,15 @@ int __ipa3_del_rt_rule(u32 rule_hdl)
return -EINVAL; return -EINVAL;
} }
if (!strcmp(entry->tbl->name, IPA_DFLT_RT_TBL_NAME)) {
IPADBG("Deleting rule from default rt table idx=%u\n",
entry->tbl->idx);
if (entry->tbl->rule_cnt == 1) {
IPAERR_RL("Default tbl last rule cannot be deleted\n");
return -EINVAL;
}
}
if (entry->hdr) if (entry->hdr)
__ipa3_release_hdr(entry->hdr->id); __ipa3_release_hdr(entry->hdr->id);
else if (entry->proc_ctx) else if (entry->proc_ctx)