return ptr;
}
+static void clear_thread_table(struct thread_table_field *ptr)
+{
+ hash_del(&ptr->next);
+ kfree(ptr);
+}
+
static inline char *get_shared_memory(int dev_index)
{
if (dev_index < 0 || dev_index >= ZLOGGER_DEVICE_COUNT) {
{
if (file->private_data != NULL) {
struct zlog_file *zlog_file_data = (struct zlog_file *)file->private_data;
+ struct thread_table_field *ptr = get_thread_table(current->pid, true);
if (zlog_file_data->buffer != NULL) {
kfree(zlog_file_data->buffer);
}
kfree(file->private_data);
file->private_data = NULL;
+
+ if (ptr) {
+ mutex_lock(&g_block_mutex);
+ clear_thread_table(ptr);
+ mutex_unlock(&g_block_mutex);
+ }
}
return 0;
}
{
struct thread_table_field *ptr = vma->vm_private_data;
- if (ptr)
+ if (ptr) {
ptr->vma = NULL;
+ mutex_lock(&g_block_mutex);
+ clear_thread_table(ptr);
+ mutex_unlock(&g_block_mutex);
+ }
}
/* called under mmap semaphore */