msm: ipa: fix to not allow NAT DMA command without device initialization
Without NAT device initialization sending NAT DMA commands leads to XPU violation. Added checks to verify device initialized or not before sending DMA command. Change-Id: I7440abc14a81e1621573f0e2808a410d60b2458d Acked-by: Ashok Vuyyuru <avuyyuru@qti.qualcomm.com> Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
This commit is contained in:
parent
d803000f57
commit
333b7dec60
2 changed files with 28 additions and 2 deletions
|
@ -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
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -327,6 +327,11 @@ int ipa2_nat_init_cmd(struct ipa_ioc_v4_nat_init *init)
|
|||
size_t tmp;
|
||||
gfp_t flag = GFP_KERNEL | (ipa_ctx->use_dma_zone ? GFP_DMA : 0);
|
||||
|
||||
if (!ipa_ctx->nat_mem.is_dev_init) {
|
||||
IPAERR_RL("Nat table not initialized\n");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
IPADBG("\n");
|
||||
if (init->table_entries == 0) {
|
||||
IPADBG("Table entries is zero\n");
|
||||
|
@ -572,6 +577,11 @@ int ipa2_nat_dma_cmd(struct ipa_ioc_nat_dma_cmd *dma)
|
|||
int ret = 0;
|
||||
gfp_t flag = GFP_KERNEL | (ipa_ctx->use_dma_zone ? GFP_DMA : 0);
|
||||
|
||||
if (!ipa_ctx->nat_mem.is_dev_init) {
|
||||
IPAERR_RL("Nat table not initialized\n");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
IPADBG("\n");
|
||||
if (dma->entries <= 0) {
|
||||
IPAERR_RL("Invalid number of commands %d\n",
|
||||
|
@ -758,6 +768,16 @@ int ipa2_nat_del_cmd(struct ipa_ioc_v4_nat_del *del)
|
|||
int result;
|
||||
gfp_t flag = GFP_KERNEL | (ipa_ctx->use_dma_zone ? GFP_DMA : 0);
|
||||
|
||||
if (!ipa_ctx->nat_mem.is_dev_init) {
|
||||
IPAERR_RL("Nat table not initialized\n");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
if (ipa_ctx->nat_mem.public_ip_addr) {
|
||||
IPAERR_RL("Public IP addr not assigned and trying to delete\n");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
IPADBG("\n");
|
||||
if (ipa_ctx->nat_mem.is_tmp_mem) {
|
||||
IPAERR("using temp memory during nat del\n");
|
||||
|
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -793,6 +793,12 @@ int ipa3_nat_del_cmd(struct ipa_ioc_v4_nat_del *del)
|
|||
}
|
||||
|
||||
memset(&desc, 0, sizeof(desc));
|
||||
|
||||
if (!ipa3_ctx->nat_mem.is_dev_init) {
|
||||
IPAERR_RL("NAT hasn't been initialized\n");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
/* NO-OP IC for ensuring that IPA pipeline is empty */
|
||||
nop_cmd_pyld =
|
||||
ipahal_construct_nop_imm_cmd(false, IPAHAL_HPS_CLEAR, false);
|
||||
|
|
Loading…
Add table
Reference in a new issue