]> git.baikalelectronics.ru Git - kernel.git/commit
mm/z3fold: fix possible null pointer dereferencing
authorMiaohe Lin <linmiaohe@huawei.com>
Fri, 29 Apr 2022 06:40:43 +0000 (14:40 +0800)
committerakpm <akpm@linux-foundation.org>
Fri, 27 May 2022 16:33:43 +0000 (09:33 -0700)
commitb2d00760d16acc753967e2f4f76f26941d9a6ba3
treed062095fadf78cede1c32b05ceb42f05ad98d234
parent5e1b2d1dd102e2a81ff6558f86a1c884c54d4126
mm/z3fold: fix possible null pointer dereferencing

alloc_slots could fail to allocate memory under heavy memory pressure.  So
we should check zhdr->slots against NULL to avoid future null pointer
dereferencing.

Link: https://lkml.kernel.org/r/20220429064051.61552-3-linmiaohe@huawei.com
Fixes: 6faa741f667a ("z3fold: simplify freeing slots")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Vitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/z3fold.c