From 3293bfaa1e72ff54a1ccf4736736f7e95517a009 Mon Sep 17 00:00:00 2001 From: Naoki Hamada Date: Thu, 28 Aug 2014 14:41:32 +0900 Subject: [PATCH] Fix for generalization. --- executer/kernel/ikc.c | 13 +++++++++---- kernel/procfs.c | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/executer/kernel/ikc.c b/executer/kernel/ikc.c index df317cd6..de376739 100644 --- a/executer/kernel/ikc.c +++ b/executer/kernel/ikc.c @@ -70,7 +70,7 @@ struct procfs_data { struct procfs_list_entry { struct list_head list; - struct procfs_data *data; + struct proc_dir_entry *entry; }; LIST_HEAD(procfs_file_list); @@ -146,7 +146,7 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c, kfree(d); goto quit; } - e->data = d; + e->entry = entry; irqflags = ihk_ikc_spinlock_lock(&procfs_file_list_lock); list_add(&(e->list), &procfs_file_list); ihk_ikc_spinlock_unlock(&procfs_file_list_lock, irqflags); @@ -167,12 +167,17 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c, f = ihk_device_map_virtual(dev, parg, sizeof(struct procfs_file), NULL, 0); dprintk("ikc: fname: %s.\n", f->fname); list_for_each_entry(e, &procfs_file_list, list) { - if (strncmp(e->data->fname, f->fname, PROCFS_NAME_MAX) == 0) { + struct procfs_data *d = (struct procfs_data *)e->entry->data; + if (d == NULL) { + continue; + } + if (strncmp(d->fname, f->fname, PROCFS_NAME_MAX) == 0) { dprintk("found and delete an entry in the list.\n"); irqflags = ihk_ikc_spinlock_lock(&procfs_file_list_lock); list_del(&e->list); ihk_ikc_spinlock_unlock(&procfs_file_list_lock, irqflags); - kfree(e->data); + kfree(e->entry->data); + e->entry->data = NULL; kfree(e); break; } diff --git a/kernel/procfs.c b/kernel/procfs.c index a44c1f20..18ebe3e1 100644 --- a/kernel/procfs.c +++ b/kernel/procfs.c @@ -50,7 +50,7 @@ void create_proc_procfs_files(int pid, int cpuid) { char fname[PROCFS_NAME_MAX]; - snprintf(fname, PROCFS_NAME_MAX, "/proc/mcos%d/%d/mem", osnum, pid); + snprintf(fname, PROCFS_NAME_MAX, "mcos%d/%d/mem", osnum, pid); create_proc_procfs_file(pid, fname, 0400, cpuid); } @@ -64,7 +64,7 @@ void delete_proc_procfs_files(int pid) { char fname[PROCFS_NAME_MAX]; - snprintf(fname, PROCFS_NAME_MAX, "/proc/mcos%d/%d/mem", osnum, pid); + snprintf(fname, PROCFS_NAME_MAX, "mcos%d/%d/mem", osnum, pid); delete_proc_procfs_file(pid, fname); }