]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mm: fix dereference a null pointer in migrate[_huge]_page_move_mapping()
authorliqiong <liqiong@nfschina.com>
Thu, 17 Feb 2022 11:54:16 +0000 (19:54 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Mar 2022 08:10:42 +0000 (09:10 +0100)
commitdeebce9df9ffaa62613bfcd8351d0c43a9a66108
tree8209b5f8691abb311ba5d1ce623e74abed480cb0
parentaa44002e7db25f333ddf412fb81e8db6c100841a
mm: fix dereference a null pointer in migrate[_huge]_page_move_mapping()

Upstream doesn't use radix tree any more in migrate.c, no need this patch.

The two functions look up a slot and dereference the pointer,
If the pointer is null, the kernel would crash and dump.

The 'numad' service calls 'migrate_pages' periodically. If some slots
being replaced (Cache Eviction), the radix_tree_lookup_slot() returns
a null pointer that causes kernel crash.

"numad":  crash> bt
[exception RIP: migrate_page_move_mapping+337]

Introduce pointer checking to avoid dereference a null pointer.

Cc: <stable@vger.kernel.org> # linux-4.19.y
Signed-off-by: liqiong <liqiong@nfschina.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/migrate.c