Commit c0c84962 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Greg Kroah-Hartman
Browse files

mm/huge_memory: Fix xarray node memory leak



commit 69a37a8b upstream.

If xas_split_alloc() fails to allocate the necessary nodes to complete the
xarray entry split, it sets the xa_state to -ENOMEM, which xas_nomem()
then interprets as "Please allocate more memory", not as "Please free
any unnecessary memory" (which was the intended outcome).  It's confusing
to use xas_nomem() to free memory in this context, so call xas_destroy()
instead.

Reported-by: default avatar <syzbot+9e27a75a8c24f3fe75c1@syzkaller.appspotmail.com>
Fixes: 6b24ca4a ("mm: Use multi-index entries in the page cache")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2e9d662a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment