Merge "msm: ipa: Fix the handling of default IPA header"

This commit is contained in:
Linux Build Service Account 2018-01-22 19:30:07 -08:00 committed by Gerrit - the friendly Code Review server
commit 0c7c2e7461
1 changed files with 23 additions and 3 deletions

View File

@ -821,8 +821,17 @@ int __ipa_del_hdr(u32 hdr_hdl, bool by_user)
return -EINVAL;
}
if (by_user)
if (by_user) {
if (!strcmp(entry->name, IPA_LAN_RX_HDR_NAME)) {
IPADBG("Trying to delete hdr %s offset=%u\n",
entry->name, entry->offset_entry->offset);
if (!entry->offset_entry->offset) {
IPAERR("User cannot delete default header\n");
return -EPERM;
}
}
entry->user_deleted = true;
}
if (--entry->ref_cnt) {
IPADBG("hdr_hdl %x ref_cnt %d\n", hdr_hdl, entry->ref_cnt);
@ -1149,8 +1158,19 @@ int ipa_reset_hdr(void)
&ipa_ctx->hdr_tbl.head_hdr_entry_list, link) {
/* do not remove the default header */
if (!strcmp(entry->name, IPA_LAN_RX_HDR_NAME))
continue;
if (!strcmp(entry->name, IPA_LAN_RX_HDR_NAME)) {
IPADBG("Trying to remove hdr %s offset=%u\n",
entry->name, entry->offset_entry->offset);
if (!entry->offset_entry->offset) {
if (entry->is_hdr_proc_ctx) {
mutex_unlock(&ipa_ctx->lock);
WARN_ON(1);
return -EFAULT;
}
IPADBG("skip default header\n");
continue;
}
}
if (ipa_id_find(entry->id) == NULL) {
WARN_ON(1);