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

This commit is contained in:
Linux Build Service Account 2017-12-30 20:50:20 -08:00 committed by Gerrit - the friendly Code Review server
commit e24ebad931
2 changed files with 42 additions and 14 deletions

View file

@ -910,8 +910,17 @@ int __ipa_del_hdr(u32 hdr_hdl, bool by_user)
return -EINVAL; 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; entry->user_deleted = true;
}
if (--entry->ref_cnt) { if (--entry->ref_cnt) {
IPADBG("hdr_hdl %x ref_cnt %d\n", hdr_hdl, entry->ref_cnt); IPADBG("hdr_hdl %x ref_cnt %d\n", hdr_hdl, entry->ref_cnt);
@ -1234,13 +1243,18 @@ int ipa2_reset_hdr(void)
/* do not remove the default header */ /* do not remove the default header */
if (!strcmp(entry->name, IPA_LAN_RX_HDR_NAME)) { if (!strcmp(entry->name, IPA_LAN_RX_HDR_NAME)) {
if (entry->is_hdr_proc_ctx) { IPADBG("Trying to remove hdr %s offset=%u\n",
mutex_unlock(&ipa_ctx->lock); entry->name, entry->offset_entry->offset);
WARN_ON(1); if (!entry->offset_entry->offset) {
IPAERR("default header is proc ctx\n"); if (entry->is_hdr_proc_ctx) {
return -EFAULT; mutex_unlock(&ipa_ctx->lock);
WARN_ON(1);
IPAERR("default header is proc ctx\n");
return -EFAULT;
}
IPADBG("skip default header\n");
continue;
} }
continue;
} }
if (ipa_id_find(entry->id) == NULL) { if (ipa_id_find(entry->id) == NULL) {

View file

@ -678,8 +678,17 @@ int __ipa3_del_hdr(u32 hdr_hdl, bool by_user)
return -EINVAL; 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; entry->user_deleted = true;
}
if (--entry->ref_cnt) { if (--entry->ref_cnt) {
IPADBG("hdr_hdl %x ref_cnt %d\n", hdr_hdl, entry->ref_cnt); IPADBG("hdr_hdl %x ref_cnt %d\n", hdr_hdl, entry->ref_cnt);
@ -978,13 +987,18 @@ int ipa3_reset_hdr(void)
/* do not remove the default header */ /* do not remove the default header */
if (!strcmp(entry->name, IPA_LAN_RX_HDR_NAME)) { if (!strcmp(entry->name, IPA_LAN_RX_HDR_NAME)) {
if (entry->is_hdr_proc_ctx) { IPADBG("Trying to remove hdr %s offset=%u\n",
IPAERR("default header is proc ctx\n"); entry->name, entry->offset_entry->offset);
mutex_unlock(&ipa3_ctx->lock); if (!entry->offset_entry->offset) {
WARN_ON(1); if (entry->is_hdr_proc_ctx) {
return -EFAULT; IPAERR("default header is proc ctx\n");
mutex_unlock(&ipa3_ctx->lock);
WARN_ON(1);
return -EFAULT;
}
IPADBG("skip default header\n");
continue;
} }
continue;
} }
if (ipa3_id_find(entry->id) == NULL) { if (ipa3_id_find(entry->id) == NULL) {