mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
mm: cma: restrict base_pfn exposure
We are exposing cma region's base_pfn without any restriction. Make this dependent on kptr_restrict configuration. Change-Id: If454194cc5e7639f33b2e1dd29f5d925a17340c1 Signed-off-by: Prakash Gupta <guptap@codeaurora.org> Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
parent
915d2b2efe
commit
01151d5fcf
1 changed files with 13 additions and 6 deletions
|
|
@ -24,12 +24,18 @@ struct cma_mem {
|
|||
static int cma_debugfs_get(void *data, u64 *val)
|
||||
{
|
||||
unsigned long *p = data;
|
||||
int ret = -EPERM;
|
||||
|
||||
*val = *p;
|
||||
if (kptr_restrict == 0) {
|
||||
*val = *p;
|
||||
ret = 0;
|
||||
} else {
|
||||
*val = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
DEFINE_SIMPLE_ATTRIBUTE(cma_debugfs_fops, cma_debugfs_get, NULL, "%llu\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(cma_debugfs_fops, cma_debugfs_get, NULL, "0x%lx\n");
|
||||
|
||||
static int cma_used_get(void *data, u64 *val)
|
||||
{
|
||||
|
|
@ -174,9 +180,10 @@ static void cma_debugfs_add_one(struct cma *cma, struct dentry *root_dentry)
|
|||
debugfs_create_file("free", 0200, tmp, cma, &cma_free_fops);
|
||||
debugfs_create_file("base_pfn", 0444, tmp,
|
||||
&cma->base_pfn, &cma_debugfs_fops);
|
||||
debugfs_create_file("count", 0444, tmp, &cma->count, &cma_debugfs_fops);
|
||||
debugfs_create_file("order_per_bit", 0444, tmp,
|
||||
&cma->order_per_bit, &cma_debugfs_fops);
|
||||
|
||||
debugfs_create_ulong("count", 0444, tmp, &cma->count);
|
||||
debugfs_create_u32("order_per_bit", 0444, tmp,
|
||||
(u32 *)&cma->order_per_bit);
|
||||
debugfs_create_file("used", 0444, tmp, cma, &cma_used_fops);
|
||||
debugfs_create_file("maxchunk", 0444, tmp, cma, &cma_maxchunk_fops);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue