mm-z3fold-fix-possible-null-pointer-dereferencing.patch removed from -mm tree
The quilt patch titled
Subject: mm/z3fold: fix possible null pointer dereferencing
has been removed from the -mm tree. Its filename was
mm-z3fold-fix-possible-null-pointer-dereferencing.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Miaohe Lin <[email protected]>
Subject: mm/z3fold: fix possible null pointer dereferencing
Date: Fri, 29 Apr 2022 14:40:43 +0800
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.
Fixes fc5488651c7d ("z3fold: simplify freeing slots")
Signed-off-by Miaohe Lin <[email protected]>
Reviewed-by Vitaly Wool <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
mm/z3fold.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
mm/z3fold.c renamed from mm/z3fold.c~mm-z3fold-fix-possible-null-pointer-dereferencing +11 -1
@@ -940,9 +940,19 @@ lookup: } } -if (zhdr && !zhdr->slots) +if (zhdr && !zhdr->slots) { zhdr->slots =alloc_slots (pool,GFP_ATOMIC ); +if (!zhdr->slots) + goto out_fail; + }return zhdr; + +out_fail: +if (!kref_put (&zhdr->refcount, release_z3fold_page_locked)) { +add_to_unbuddied (pool, zhdr); +z3fold_page_unlock (zhdr); + } +return NULL ; }/*
_
Patches currently in -mm which might be from [email protected] are