[PATCH 4.18 183/197] mm: respect arch_dup_mmap() return value
- Date: Thu, 13 Sep 2018 15:32:12 +0200
- From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
- Subject: [PATCH 4.18 183/197] mm: respect arch_dup_mmap() return value
4.18-stable review patch. If anyone has any objections, please let me know.
From: Nadav Amit <namit@xxxxxxxxxx>
commit 1ed0cc5a01a4d868d9907ce96468c4b4c6709556 upstream.
Commit d70f2a14b72a ("include/linux/sched/mm.h: uninline mmdrop_async(),
etc") ignored the return value of arch_dup_mmap(). As a result, on x86,
a failure to duplicate the LDT (e.g. due to memory allocation error)
would leave the duplicated memory mapping in an inconsistent state.
Fix by using the return value, as it was before the change.
Fixes: d70f2a14b72a4 ("include/linux/sched/mm.h: uninline mmdrop_async(), etc")
Signed-off-by: Nadav Amit <namit@xxxxxxxxxx>
Acked-by: Michal Hocko <mhocko@xxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
kernel/fork.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
@@ -549,8 +549,7 @@ static __latent_entropy int dup_mmap(str
/* a new mm has just been created */
- arch_dup_mmap(oldmm, mm);
- retval = 0;
+ retval = arch_dup_mmap(oldmm, mm);