]> git.baikalelectronics.ru Git - kernel.git/commit
kthread: fix boot hang (regression) on MIPS/OpenRISC
authorVegard Nossum <vegard.nossum@oracle.com>
Mon, 29 May 2017 07:22:07 +0000 (09:22 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 29 May 2017 16:40:54 +0000 (09:40 -0700)
commitd5a0433ffbbdef20f805d23b52e0e54d702410fa
treecfa80df40f7e628f2bd1380c6e679a83812c96b1
parent03d45e13ad6a0e926ff24a256af2833c5b20902e
kthread: fix boot hang (regression) on MIPS/OpenRISC

This fixes a regression in commit 7c062669a726 where I didn't notice
that MIPS and OpenRISC were reinitialising p->{set,clear}_child_tid to
NULL after our initialisation in copy_process().

We can simply get rid of the arch-specific initialisation here since it
is now always done in copy_process() before hitting copy_thread{,_tls}().

Review notes:

 - As far as I can tell, copy_process() is the only user of
   copy_thread_tls(), which is the only caller of copy_thread() for
   architectures that don't implement copy_thread_tls().

 - After this patch, there is no arch-specific code touching
   p->set_child_tid or p->clear_child_tid whatsoever.

 - It may look like MIPS/OpenRISC wanted to always have these fields be
   NULL, but that's not true, as copy_process() would unconditionally
   set them again _after_ calling copy_thread_tls() before commit
   7c062669a726.

Fixes: 7c062669a7269d54a25bad08fca8d08975b4efee ("kthread: Fix use-after-free if kthread fork fails")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net> # MIPS only
Acked-by: Stafford Horne <shorne@gmail.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: openrisc@lists.librecores.org
Cc: Jamie Iles <jamie.iles@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/mips/kernel/process.c
arch/openrisc/kernel/process.c