Merge "msm: ipa: fix potential NULL pointer dereference"
diff --git a/drivers/platform/msm/ipa/ipa_flt.c b/drivers/platform/msm/ipa/ipa_flt.c
index 2d75141..c3db716 100644
--- a/drivers/platform/msm/ipa/ipa_flt.c
+++ b/drivers/platform/msm/ipa/ipa_flt.c
@@ -802,8 +802,11 @@
IPADBG("reset flt ip=%d\n", ip);
list_for_each_entry_safe(entry, next, &tbl->head_flt_rule_list, link) {
node = ipa_search(&ipa_ctx->flt_rule_hdl_tree, (u32)entry);
- if (node == NULL)
+ if (node == NULL) {
WARN_ON(1);
+ mutex_unlock(&ipa_ctx->lock);
+ return -EFAULT;
+ }
if ((ip == IPA_IP_v4 &&
entry->rule.attrib.attrib_mask == IPA_FLT_PROTOCOL &&
@@ -833,8 +836,11 @@
link) {
node = ipa_search(&ipa_ctx->flt_rule_hdl_tree,
(u32)entry);
- if (node == NULL)
+ if (node == NULL) {
WARN_ON(1);
+ mutex_unlock(&ipa_ctx->lock);
+ return -EFAULT;
+ }
list_del(&entry->link);
entry->tbl->rule_cnt--;
if (entry->rt_tbl)