You've already forked KernelSU-Next
mirror of
https://github.com/KernelSU-Next/KernelSU-Next.git
synced 2025-08-27 23:46:34 +00:00
kernel: throne_tracker: harden track_throne_function file read
this probably wont happen, but just to make sure, we dont block the rename now so there is really a chance that this does not exist yet when the kthread runs. Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
This commit is contained in:
@@ -305,13 +305,24 @@ static bool is_uid_exist(uid_t uid, char *package, void *data)
|
|||||||
|
|
||||||
void track_throne()
|
void track_throne()
|
||||||
{
|
{
|
||||||
struct file *fp =
|
struct file *fp;
|
||||||
ksu_filp_open_compat(SYSTEM_PACKAGES_LIST_PATH, O_RDONLY, 0);
|
int tries = 0;
|
||||||
|
|
||||||
|
while (tries++ < 10) {
|
||||||
|
fp = ksu_filp_open_compat(SYSTEM_PACKAGES_LIST_PATH, O_RDONLY, 0);
|
||||||
|
if (!IS_ERR(fp)) // success, file exists
|
||||||
|
break;
|
||||||
|
|
||||||
|
pr_info("%s: waiting for %s\n", __func__, SYSTEM_PACKAGES_LIST_PATH);
|
||||||
|
schedule(); // maybe enough, otherwise, add delay?
|
||||||
|
msleep(100); // migth as well add a delay
|
||||||
|
};
|
||||||
|
|
||||||
if (IS_ERR(fp)) {
|
if (IS_ERR(fp)) {
|
||||||
pr_err("%s: open " SYSTEM_PACKAGES_LIST_PATH " failed: %ld\n",
|
pr_err("%s: open " SYSTEM_PACKAGES_LIST_PATH " failed: %ld\n", __func__, PTR_ERR(fp));
|
||||||
__func__, PTR_ERR(fp));
|
|
||||||
return;
|
return;
|
||||||
}
|
} else
|
||||||
|
pr_info("%s: %s found!\n", __func__, SYSTEM_PACKAGES_LIST_PATH);
|
||||||
|
|
||||||
struct list_head uid_list;
|
struct list_head uid_list;
|
||||||
INIT_LIST_HEAD(&uid_list);
|
INIT_LIST_HEAD(&uid_list);
|
||||||
|
|||||||
Reference in New Issue
Block a user