[PATCH] fork: Using oldmm replace current->mm for dup_mm
From: zhijun.han
Date: Tue Jul 30 2024 - 04:34:02 EST
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@xxxxxxxxx>
---
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