From: Ma Wupeng mawupeng1@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8K5CO
--------------------------------
Invalid value will be returned if there is no suitable pfn during search, fix it.
Fixes: ecbd5d7cb9c7 ("mm: page_eject: Introuduce page ejection") Signed-off-by: Ma Wupeng mawupeng1@huawei.com --- drivers/ras/page_eject.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/ras/page_eject.c b/drivers/ras/page_eject.c index 1d609384b692..13db543edfbc 100644 --- a/drivers/ras/page_eject.c +++ b/drivers/ras/page_eject.c @@ -20,18 +20,19 @@ struct ejected_pfn {
static struct ejected_pfn *page_eject_remove_pfn_locked(unsigned long pfn) { - struct ejected_pfn *item = NULL, *next; + struct ejected_pfn *item, *next, *ret = NULL;
mutex_lock(&eject_page_mutex); list_for_each_entry_safe(item, next, &eject_page_list, list) { if (pfn == item->pfn) { list_del(&item->list); + ret = item; break; } } mutex_unlock(&eject_page_mutex);
- return item; + return ret; }
static void page_eject_add_pfn_locked(struct ejected_pfn *item)