From 9692ed2f93777e1060837b97687509f8a22c2b60 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Tue, 3 May 2022 20:31:50 +0200 Subject: kernel: reference count mount objects, free them on process kills --- src/kernel/syscalls.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/kernel/syscalls.c') diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 57286f1..7748bc5 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -109,12 +109,17 @@ int _syscall_mount(handle_t hid, const char __user *path, int len) { } // otherwise backend == NULL // append to mount list + // TODO move to kernel/vfs/mount.c mount = kmalloc(sizeof *mount); mount->prev = process_current->mount; - mount->prefix = path_buf; + mount->prefix = path_buf; // owned mount->prefix_len = len; mount->backend = backend; + mount->refs = 1; process_current->mount = mount; + + kmalloc_sanity(mount); + kmalloc_sanity(mount->prefix); return 0; fail: -- cgit v1.2.3