From fe2f4dbf0cbc0383d55490185a6164681909a165 Mon Sep 17 00:00:00 2001 From: Subash Abhinov Kasiviswanathan Date: Mon, 20 Apr 2020 13:18:12 -0600 Subject: rmnet_shs: Change file permissions Remove the root user and group permissions from the proc files. CRs-Fixed: 2668115 Change-Id: Ib0b9502db4d52c20554e19762d72afd05c7b1532 Signed-off-by: Subash Abhinov Kasiviswanathan --- drivers/rmnet/shs/rmnet_shs_wq_mem.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/rmnet/shs/rmnet_shs_wq_mem.c b/drivers/rmnet/shs/rmnet_shs_wq_mem.c index 062edb7..e914d78 100644 --- a/drivers/rmnet/shs/rmnet_shs_wq_mem.c +++ b/drivers/rmnet/shs/rmnet_shs_wq_mem.c @@ -955,8 +955,17 @@ void rmnet_shs_wq_mem_update_cached_netdevs(void) /* Creates the proc folder and files for shs shared memory */ void rmnet_shs_wq_mem_init(void) { + kuid_t shs_uid; + kgid_t shs_gid; + shs_proc_dir = proc_mkdir("shs", NULL); + shs_uid = make_kuid(&init_user_ns, 1001); + shs_gid = make_kgid(&init_user_ns, 1001); + + if (uid_valid(shs_uid) && gid_valid(shs_gid)) + proc_set_user(shs_proc_dir, shs_uid, shs_gid); + proc_create(RMNET_SHS_PROC_CAPS, 0644, shs_proc_dir, &rmnet_shs_caps_fops); proc_create(RMNET_SHS_PROC_G_FLOWS, 0644, shs_proc_dir, &rmnet_shs_g_flows_fops); proc_create(RMNET_SHS_PROC_SS_FLOWS, 0644, shs_proc_dir, &rmnet_shs_ss_flows_fops); -- cgit v1.2.3