Skip to content

Commit aafc408

Browse files
5ec1cffjinetty
authored andcommitted
kernelsu: simpler implementation of copying policydb (tiann/KernelSU#3350)
1 parent 13046fe commit aafc408

2 files changed

Lines changed: 60 additions & 440 deletions

File tree

drivers/kernelsu/selinux/rules.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ void apply_kernelsu_rules()
5252
mutex_lock(&selinux_state.policy_mutex);
5353
pol = ksu_dup_sepolicy(rcu_dereference_protected(
5454
old_pol, lockdep_is_held(&selinux_state.policy_mutex)));
55-
if (!pol) {
56-
pr_err("failed to dup selinux_policy\n");
55+
if (IS_ERR(pol)) {
56+
pr_err("failed to dup selinux_policy: %ld\n", PTR_ERR(pol));
5757
goto out_unlock;
5858
}
5959

@@ -455,8 +455,9 @@ int handle_sepolicy(void __user *user_data, u64 data_len)
455455
old_pol = selinux_state.policy;
456456
pol = ksu_dup_sepolicy(rcu_dereference_protected(
457457
old_pol, lockdep_is_held(&selinux_state.policy_mutex)));
458-
if (!pol) {
459-
ret = -ENOMEM;
458+
if (IS_ERR(pol)) {
459+
ret = PTR_ERR(pol);
460+
pr_err("ksu_dup_sepolicy err: %d\n", ret);
460461
goto out_unlock;
461462
}
462463
db = &pol->policydb;

0 commit comments

Comments
 (0)