@@ -108,6 +108,7 @@ static void setup_groups(struct root_profile *profile, struct cred *cred)
108108
109109 groups_sort (group_info );
110110 set_groups (cred , group_info );
111+ put_group_info (group_info );
111112}
112113
113114static void disable_seccomp ()
@@ -132,18 +133,18 @@ void escape_to_root(void)
132133{
133134 struct cred * cred ;
134135
135- rcu_read_lock ();
136-
137- do {
138- cred = (struct cred * )__task_cred ((current ));
139- BUG_ON (!cred );
140- } while (!get_cred_rcu (cred ));
136+ cred = prepare_creds ();
137+ if (!cred ) {
138+ pr_warn ("prepare_creds failed!\n" );
139+ return ;
140+ }
141141
142142 if (cred -> euid .val == 0 ) {
143143 pr_warn ("Already root, don't escape!\n" );
144- rcu_read_unlock ( );
144+ abort_creds ( cred );
145145 return ;
146146 }
147+
147148 struct root_profile * profile = ksu_get_root_profile (cred -> uid .val );
148149
149150 cred -> uid .val = profile -> uid ;
@@ -174,7 +175,7 @@ void escape_to_root(void)
174175
175176 setup_groups (profile , cred );
176177
177- rcu_read_unlock ( );
178+ commit_creds ( cred );
178179
179180 // Refer to kernel/seccomp.c: seccomp_set_mode_strict
180181 // When disabling Seccomp, ensure that current->sighand->siglock is held during the operation.
@@ -241,7 +242,7 @@ static void nuke_ext4_sysfs() {
241242 }
242243
243244 ext4_unregister_sysfs (sb );
244- path_put (& path );
245+ path_put (& path );
245246}
246247
247248int ksu_handle_prctl (int option , unsigned long arg2 , unsigned long arg3 ,
0 commit comments