diff --git a/kernel/apk_sign.c b/kernel/apk_sign.c index bca2c073..c1e803d7 100644 --- a/kernel/apk_sign.c +++ b/kernel/apk_sign.c @@ -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); -} \ No newline at end of file +}