]> git.karo-electronics.de Git - karo-tx-linux.git/commit
um: fix possible race on task->mm
authorAnton Vorontsov <anton.vorontsov@linaro.org>
Thu, 3 May 2012 05:44:47 +0000 (15:44 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 3 May 2012 05:46:59 +0000 (15:46 +1000)
commit27bc05b7bbee9c7f58a0e5fad5a17b6e670b08b5
tree362e2a325918a485a16e1e1412cc0f7754f4750d
parent3794fbb1267d1da7ea9703bf0aa76850cd94f5fe
um: fix possible race on task->mm

Checking for task->mm is dangerous as ->mm might disappear (exit_mm()
assigns NULL under task_lock(), so tasklist lock is not enough).

We can't use get_task_mm()/mmput() pair as mmput() might sleep, so let's
take the task lock while we care about its mm.

Note that we should also use find_lock_task_mm() to check all process'
threads for a valid mm, but for uml we'll do it in a separate patch.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/um/kernel/reboot.c