[PATCH] fork: Using oldmm replace current->mm for dup_mm

zhijun.han posted 1 patch 1 year, 6 months ago
kernel/fork.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] fork: Using oldmm replace current->mm for dup_mm
Posted by zhijun.han 1 year, 6 months ago
In the current implementation of copy_mm(),there is a line
initializes `oldmm = current->mm` before dup_mm.
This means that there is no longer a need to use current->mm for
dup_mm.

Signed-off-by: zhijun.han <hanzj.it@gmail.com>
---
 kernel/fork.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 41771bde2ce7..833557bb0187 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1720,7 +1720,7 @@ static int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
 		mmget(oldmm);
 		mm = oldmm;
 	} else {
-		mm = dup_mm(tsk, current->mm);
+		mm = dup_mm(tsk, oldmm);
 		if (!mm)
 			return -ENOMEM;
 	}
-- 
2.45.2