kernel: apk_sign: loop file open on is_manager_apk

lets loop on this and wait for installation to finish

this is the third race.
This commit is contained in:
backslashxx
2025-06-13 11:51:07 +08:00
committed by Rifat Azad
parent fc58bdf0e2
commit 06135cc827

View File

@@ -188,10 +188,6 @@ static __always_inline bool check_v2_signature(char *path,
bool v3_1_signing_exist = false;
int i;
if (is_lock_held(path))
return false;
struct file *fp = ksu_filp_open_compat(path, O_RDONLY, 0);
if (IS_ERR(fp)) {
pr_err("open %s error.\n", path);
@@ -321,5 +317,21 @@ module_param_cb(ksu_debug_manager_uid, &expected_size_ops,
bool is_manager_apk(char *path)
{
int tries = 0;
while (tries++ < 10) {
if (!is_lock_held(path))
break;
pr_info("%s: waiting for %s\n", __func__, path);
msleep(100);
}
// let it go, if retry fails, check_v2_signature will fail to open it anyway
if (tries == 10) {
pr_info("%s: timeout for %s\n", __func__, path);
return false;
}
return check_v2_signature(path, EXPECTED_NEXT_SIZE, EXPECTED_NEXT_HASH);
}
}