msm: ipa: Add guard around nat entries read

Add mutext lock protection around nat read
functino in debugfs to avoid nat table delete
during read.

Change-Id: Id38737dad70853ccd83685841d0c2498ee722ff2
CRs-Fixed: 1075605
Signed-off-by: Sunil Paidimarri <hisunil@codeaurora.org>
This commit is contained in:
Sunil Paidimarri 2016-10-07 14:32:54 -07:00
parent 3c7400dc73
commit 38b227b0c2
2 changed files with 4 additions and 0 deletions

View file

@ -1420,6 +1420,7 @@ static ssize_t ipa_read_nat4(struct file *file,
u16 enable, tbl_entry, flag;
u32 no_entrys = 0;
mutex_lock(&ipa_ctx->nat_mem.lock);
value = ipa_ctx->nat_mem.public_ip_addr;
pr_err(
"Table IP Address:%d.%d.%d.%d\n",
@ -1573,6 +1574,7 @@ static ssize_t ipa_read_nat4(struct file *file,
}
}
pr_err("Current No. Nat Entries: %d\n", no_entrys);
mutex_unlock(&ipa_ctx->nat_mem.lock);
return 0;
}

View file

@ -1478,6 +1478,7 @@ static ssize_t ipa3_read_nat4(struct file *file,
u16 enable, tbl_entry, flag;
u32 no_entrys = 0;
mutex_lock(&ipa3_ctx->nat_mem.lock);
value = ipa3_ctx->nat_mem.public_ip_addr;
pr_err(
"Table IP Address:%d.%d.%d.%d\n",
@ -1631,6 +1632,7 @@ static ssize_t ipa3_read_nat4(struct file *file,
}
}
pr_err("Current No. Nat Entries: %d\n", no_entrys);
mutex_unlock(&ipa3_ctx->nat_mem.lock);
return 0;
}