lkml.org 
[lkml]   [2004]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[2/2] correct use_mm()/unuse_mm() to use task_lock() to protect ->mm
Split off from suparna's patches:

Correct use_mm()/unuse_mm() to use task_lock() to protect task->mm.

Index: suparna-2.6.7-rc2/fs/aio.c
===================================================================
--- suparna-2.6.7-rc2.orig/fs/aio.c 2004-05-31 22:06:35.788770000 -0700
+++ suparna-2.6.7-rc2/fs/aio.c 2004-05-31 22:08:41.057727000 -0700
@@ -538,19 +538,25 @@

static void use_mm(struct mm_struct *mm)
{
- struct mm_struct *active_mm = current->active_mm;
+ struct mm_struct *active_mm;
+
atomic_inc(&mm->mm_count);
+ task_lock(current);
+ active_mm = current->active_mm;
current->mm = mm;
if (mm != active_mm) {
current->active_mm = mm;
activate_mm(active_mm, mm);
}
+ task_unlock(current);
mmdrop(active_mm);
}

static void unuse_mm(struct mm_struct *mm)
{
+ task_lock(current);
current->mm = NULL;
+ task_unlock(current);
/* active_mm is still 'mm' */
enter_lazy_tlb(mm, current);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:03    [W:0.028 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site