Skip to content

Commit 3d3b8a9

Browse files
committed
Merge branch 'main' of ssh://github.com/StratifyLabs/StratifyOS
2 parents 49cd655 + 552c3b1 commit 3d3b8a9

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/sys/sysfs/appfs.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ int appfs_open(const void *cfg, void **handle, const char *path, int flags, int
207207
ret = SYSFS_SET_RETURN(EINVAL);
208208
}
209209
h->is_install = 1;
210+
h->type.install = (appfs_util_handle_t){};
210211
#if CONFIG_APPFS_IS_VERIFY_SIGNATURE
211212
h->type.install.ecc_api = sos_config.sys.kernel_request_api(CRYPT_ECC_API_REQUEST);
212213
h->type.install.sha256_api =
@@ -541,12 +542,16 @@ void svcall_close(void *args) {
541542
if (sos_config.cache.enable) {
542543
sos_config.cache.invalidate_instruction();
543544

544-
appfs_handle_t *h = args;
545-
sos_config.cache.clean_data_block(
546-
(void *)(h->type.install.code_start), h->type.install.code_size);
545+
const appfs_handle_t * h = args;
546+
if (h->type.install.code_size) {
547+
sos_config.cache.clean_data_block(
548+
(void *)(h->type.install.code_start), h->type.install.code_size);
549+
}
547550

548-
sos_config.cache.clean_data_block(
549-
(void *)(h->type.install.data_start), h->type.install.data_size);
551+
if (h->type.install.data_size) {
552+
sos_config.cache.clean_data_block(
553+
(void *)(h->type.install.data_start), h->type.install.data_size);
554+
}
550555
}
551556
}
552557

@@ -675,7 +680,7 @@ void svcall_ioctl(void *args) {
675680
} else {
676681
// mark as non-executable
677682
file->exec.signature = ~APPFS_CREATE_SIGNATURE;
678-
//clear priviledged flags
683+
// clear priviledged flags
679684
file->exec.o_flags &= ~(APPFS_FLAG_IS_AUTHENTICATED | APPFS_FLAG_IS_STARTUP);
680685
file->hdr.mode = 0444; // read only
681686

0 commit comments

Comments
 (0)