Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 111f081f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa: fix to not allow NAT DMA command without device initialization"

parents 8b9efad8 ca488b25
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -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");
+6 −1
Original line number Diff line number Diff line
/* 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,11 @@ 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);