mm: fix NULL ptr dereference in move_pages
authorSasha Levin <levinsasha928@gmail.com>
Wed, 25 Apr 2012 23:01:53 +0000 (16:01 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 15 Sep 2017 17:30:57 +0000 (18:30 +0100)
commit125a66961a14d740fe1a0a5398c2aaf7f715d17e
tree8af6eb97f89ca6931648151a4a3065bca9a86de5
parentd4f17eb3675ae072732a2dec54a450e7a3be05dd
mm: fix NULL ptr dereference in move_pages

commit 6e8b09eaf268bceac0c62e389b4bc0cb83dfb8e5 upstream.

Commit 3268c63 ("mm: fix move/migrate_pages() race on task struct") has
added an odd construct where 'mm' is checked for being NULL, and if it is,
it would get dereferenced anyways by mput()ing it.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Cc: Dave Hansen <dave@linux.vnet.ibm.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Hugh Dickins <hughd@google.com>
Acked-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
mm/migrate.c