oom_kill: has_intersects_mems_allowed() needs rcu_read_lock()
oom_kill: has_intersects_mems_allowed() needs rcu_read_lock()

At least out_of_memory() calls has_intersects_mems_allowed() without
even rcu_read_lock(), this is obviously buggy.

Add the necessary rcu_read_lock().  This means that we can not simply
return from the loop, we need "bool ret" and "break".

While at it, swap the names of task_struct's (the argument and the
local).  This cleans up the code a little bit and avoids the unnecessary
initialization.

Signed-off-by: Oleg Nesterov <20b70f0af00562e63758b9ee42012ecc96c58590@redhat.com>
Reviewed-by: Sergey Dyasly <9ab5ef8bf102d1216a45531f6a1fe327021f918d@gmail.com>
Tested-by: Sergey Dyasly <9ab5ef8bf102d1216a45531f6a1fe327021f918d@gmail.com>
Reviewed-by: Sameer Nanda <3daf6939ed4518939423e49b8a1025b098597787@chromium.org>
Cc: "Eric W. Biederman" <8a741aa8cbd77ebc4a56ddb528ce9fd15d42f034@xmission.com>
Cc: Frederic Weisbecker <e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com>
Cc: Mandeep Singh Baines <19acf4ef1f391f4aab404dc5703cac3632e06f3a@chromium.org>
Cc: "Ma, Xindong" <4066161ad7b49f5b39be02340a4a50c70c9a0caf@intel.com>
Reviewed-by: Michal Hocko <829500b200af6c2a0eca4dfd5c388e6b8fbe8dc6@suse.cz>
Cc: "Tu, Xiaobing" <b2a0efa288d2011c6587a4a8516b5d7bd5f3174b@intel.com>
Acked-by: David Rientjes <d8cd2994e15bc61ddb2b113030bda55eebc3a0fe@google.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs