Merge tag 'LA.UM.9.14.r1-24900-LAHAINA.QSSI14.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/dataipa into android13-5.4-lahaina

"LA.UM.9.14.r1-24900-LAHAINA.QSSI14.0"

* tag 'LA.UM.9.14.r1-24900-LAHAINA.QSSI14.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/dataipa:
  msm: ipa: Add additional cleanup in finish rt rule addition
  msm: ipa: Add additional cleanup in finish rt rule addition

Change-Id: Ic51c62ff63dc875fb537329316d09c52aee89197
This commit is contained in:
Michael Bestas 2024-08-05 23:58:26 +03:00
commit cf9c5fb631
No known key found for this signature in database
GPG Key ID: CC95044519BE6669

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/bitops.h>
@ -1078,12 +1079,14 @@ error:
static int __ipa_finish_rt_rule_add(struct ipa3_rt_entry *entry, u32 *rule_hdl,
struct ipa3_rt_tbl *tbl)
{
int id;
int id, res = 0;
if (tbl->rule_cnt < IPA_RULE_CNT_MAX)
tbl->rule_cnt++;
else
goto table_insert_failed;
else {
res = -EINVAL;
goto failed;
}
if (entry->hdr)
entry->hdr->ref_cnt++;
else if (entry->proc_ctx)
@ -1092,6 +1095,7 @@ static int __ipa_finish_rt_rule_add(struct ipa3_rt_entry *entry, u32 *rule_hdl,
if (id < 0) {
IPAERR_RL("failed to add to tree\n");
WARN_ON_RATELIMIT_IPA(1);
res = -EPERM;
goto ipa_insert_failed;
}
IPADBG("add rt rule tbl_idx=%d rule_cnt=%d rule_id=%d\n",
@ -1106,11 +1110,11 @@ ipa_insert_failed:
entry->hdr->ref_cnt--;
else if (entry->proc_ctx)
entry->proc_ctx->ref_cnt--;
failed:
idr_remove(tbl->rule_ids, entry->rule_id);
table_insert_failed:
list_del(&entry->link);
kmem_cache_free(ipa3_ctx->rt_rule_cache, entry);
return -EPERM;
return res;
}
static int __ipa_add_rt_rule(enum ipa_ip_type ip, const char *name,