diff --git a/kernel/selinux/rules.c b/kernel/selinux/rules.c index 35aef06d..9f66948b 100644 --- a/kernel/selinux/rules.c +++ b/kernel/selinux/rules.c @@ -36,7 +36,7 @@ static struct policydb *get_policydb(void) return db; } -static DEFINE_MUTEX(apply_ksu_rules_mutex); +static DEFINE_MUTEX(ksu_rules); void ksu_apply_kernelsu_rules() { @@ -46,7 +46,7 @@ void ksu_apply_kernelsu_rules() pr_info("SELinux permissive or disabled, apply rules!\n"); } - mutex_lock(&apply_ksu_rules_mutex); + mutex_lock(&ksu_rules); db = get_policydb(); @@ -149,7 +149,7 @@ void ksu_apply_kernelsu_rules() susfs_set_zygote_sid(); #endif - mutex_unlock(&apply_ksu_rules_mutex); + mutex_unlock(&ksu_rules); } #define MAX_SEPOL_LEN 128 @@ -233,9 +233,10 @@ static void reset_avc_cache() selinux_xfrm_notify_policyload(); } -static DEFINE_MUTEX(ksu_handle_sepolicy_mutex); int ksu_handle_sepolicy(unsigned long arg3, void __user *arg4) { + struct policydb *db; + if (!arg4) { return -1; } @@ -282,7 +283,7 @@ int ksu_handle_sepolicy(unsigned long arg3, void __user *arg4) struct policydb *db; - mutex_lock(&ksu_handle_sepolicy_mutex); + mutex_lock(&ksu_rules); db = get_policydb(); @@ -534,7 +535,7 @@ int ksu_handle_sepolicy(unsigned long arg3, void __user *arg4) } exit: - mutex_unlock(&ksu_handle_sepolicy_mutex); + mutex_unlock(&ksu_rules); // only allow and xallow needs to reset avc cache, but we cannot do that because // we are in atomic context. so we just reset it every time.