mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-19 07:39:54 +02:00
mm/filemap: return early if failed to allocate memory for split
commitde60fd8dde
upstream. xas_split_alloc could fail with NOMEM, and in such case, it should abort early instead of keep going and fail the xas_split below. Link: https://lkml.kernel.org/r/20240416071722.45997-1-ryncsn@gmail.com Link: https://lkml.kernel.org/r/20240415171857.19244-1-ryncsn@gmail.com Link: https://lkml.kernel.org/r/20240415171857.19244-2-ryncsn@gmail.com Signed-off-by: Kairui Song <kasong@tencent.com> Acked-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Stable-dep-of:6758c1128c
("mm/filemap: optimize filemap folio adding") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4d0261cea4
commit
ff3c557fa9
|
@ -872,9 +872,12 @@ noinline int __filemap_add_folio(struct address_space *mapping,
|
||||||
unsigned int order = xa_get_order(xas.xa, xas.xa_index);
|
unsigned int order = xa_get_order(xas.xa, xas.xa_index);
|
||||||
void *entry, *old = NULL;
|
void *entry, *old = NULL;
|
||||||
|
|
||||||
if (order > folio_order(folio))
|
if (order > folio_order(folio)) {
|
||||||
xas_split_alloc(&xas, xa_load(xas.xa, xas.xa_index),
|
xas_split_alloc(&xas, xa_load(xas.xa, xas.xa_index),
|
||||||
order, gfp);
|
order, gfp);
|
||||||
|
if (xas_error(&xas))
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
xas_lock_irq(&xas);
|
xas_lock_irq(&xas);
|
||||||
xas_for_each_conflict(&xas, entry) {
|
xas_for_each_conflict(&xas, entry) {
|
||||||
old = entry;
|
old = entry;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user