From: Yu Kuai yukuai3@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I78RYS CVE: NA
--------------------------------
Currently, the caller of eufs_alloc_page() and eufs_zalloc_page() expect that allocation won't fail, otherwise null_ptr_dereference will be triggered.
Fix this problem by adding flag __GFP_NOFAIL.
Signed-off-by: Yu Kuai yukuai3@huawei.com Reviewed-by: Hou Tao houtao1@huawei.com Signed-off-by: Jialin Zhang zhangjialin11@huawei.com --- fs/eulerfs/kmem_cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/eulerfs/kmem_cache.c b/fs/eulerfs/kmem_cache.c index 8b8299edf8ad..ec3e38ec23f5 100644 --- a/fs/eulerfs/kmem_cache.c +++ b/fs/eulerfs/kmem_cache.c @@ -77,11 +77,11 @@ void destroy_dep_node_cache(void)
void *eufs_zalloc_page(void) { - return kmem_cache_zalloc(eufs_page_cachep, GFP_NOFS); + return kmem_cache_zalloc(eufs_page_cachep, GFP_NOFS | __GFP_NOFAIL); } void *eufs_alloc_page(void) { - return kmem_cache_alloc(eufs_page_cachep, GFP_NOFS); + return kmem_cache_alloc(eufs_page_cachep, GFP_NOFS | __GFP_NOFAIL); } void eufs_free_page(void *page) {