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

Commit e5ae4557 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 073d1310 8c87da43
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");
@@ -576,6 +581,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",
@@ -762,6 +772,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");
+5 −0
Original line number Diff line number Diff line
@@ -1258,6 +1258,11 @@ int ipa3_table_dma_cmd(struct ipa_ioc_nat_dma_cmd *dma)
		goto bail;
	}

	if (!ipa3_ctx->nat_mem.dev.is_dev_init) {
		IPAERR_RL("NAT hasn't been initialized\n");
		return -EPERM;
	}

	for (cnt = 0; cnt < dma->entries; ++cnt) {
		result = ipa3_table_validate_table_dma_one(&dma->dma[cnt]);
		if (result) {