This is a note to let you know that I've just added the patch titled mm/swapfile.c: use kvzalloc for swap_info_struct allocation to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mm-swapfile.c-use-kvzalloc-for-swap_info_struct-allocation.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 873d7bcfd066663e3e50113dc4a0de19289b6354 Mon Sep 17 00:00:00 2001 From: Vasily Averin <vvs@xxxxxxxxxxxxx> Date: Fri, 16 Nov 2018 15:08:11 -0800 Subject: mm/swapfile.c: use kvzalloc for swap_info_struct allocation From: Vasily Averin <vvs@xxxxxxxxxxxxx> commit 873d7bcfd066663e3e50113dc4a0de19289b6354 upstream. Commit a2468cc9bfdf ("swap: choose swap device according to numa node") changed 'avail_lists' field of 'struct swap_info_struct' to an array. In popular linux distros it increased size of swap_info_struct up to 40 Kbytes and now swap_info_struct allocation requires order-4 page. Switch to kvzmalloc allows to avoid unexpected allocation failures. Link: http://lkml.kernel.org/r/fc23172d-3c75-21e2-d551-8b1808cbe593@xxxxxxxxxxxxx Fixes: a2468cc9bfdf ("swap: choose swap device according to numa node") Signed-off-by: Vasily Averin <vvs@xxxxxxxxxxxxx> Acked-by: Aaron Lu <aaron.lu@xxxxxxxxx> Acked-by: Michal Hocko <mhocko@xxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Huang Ying <ying.huang@xxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- mm/swapfile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2820,7 +2820,7 @@ static struct swap_info_struct *alloc_sw unsigned int type; int i; - p = kzalloc(sizeof(*p), GFP_KERNEL); + p = kvzalloc(sizeof(*p), GFP_KERNEL); if (!p) return ERR_PTR(-ENOMEM); @@ -2831,7 +2831,7 @@ static struct swap_info_struct *alloc_sw } if (type >= MAX_SWAPFILES) { spin_unlock(&swap_lock); - kfree(p); + kvfree(p); return ERR_PTR(-EPERM); } if (type >= nr_swapfiles) { @@ -2845,7 +2845,7 @@ static struct swap_info_struct *alloc_sw smp_wmb(); nr_swapfiles++; } else { - kfree(p); + kvfree(p); p = swap_info[type]; /* * Do not memset this entry: a racing procfs swap_next() Patches currently in stable-queue which might be from vvs@xxxxxxxxxxxxx are queue-4.19/ext4-fix-buffer-leak-in-ext4_expand_extra_isize_ea-on-error-path.patch queue-4.19/ext4-add-missing-brelse-add_new_gdb_meta_bg-s-error-path.patch queue-4.19/mm-swapfile.c-use-kvzalloc-for-swap_info_struct-allocation.patch queue-4.19/ext4-avoid-buffer-leak-in-ext4_orphan_add-after-prior-errors.patch queue-4.19/ext4-missing-bh-check-in-ext4_xattr_inode_write.patch queue-4.19/ext4-avoid-buffer-leak-on-shutdown-in-ext4_mark_iloc_dirty.patch queue-4.19/ext4-release-bs.bh-before-re-using-in-ext4_xattr_block_find.patch queue-4.19/ext4-fix-missing-cleanup-if-ext4_alloc_flex_bg_array-fails-while-resizing.patch queue-4.19/ext4-fix-buffer-leak-in-__ext4_read_dirblock-on-error-path.patch queue-4.19/ext4-fix-possible-inode-leak-in-the-retry-loop-of-ext4_resize_fs.patch queue-4.19/ext4-fix-buffer-leak-in-ext4_xattr_get_block-on-error-path.patch queue-4.19/ext4-fix-possible-leak-of-sbi-s_group_desc_leak-in-error-path.patch queue-4.19/ext4-add-missing-brelse-in-set_flexbg_block_bitmap-s-error-path.patch queue-4.19/ext4-fix-buffer-leak-in-ext4_xattr_move_to_block-on-error-path.patch queue-4.19/ext4-avoid-potential-extra-brelse-in-setup_new_flex_group_blocks.patch queue-4.19/ext4-add-missing-brelse-update_backups-s-error-path.patch queue-4.19/ext4-avoid-possible-double-brelse-in-add_new_gdb-on-error-path.patch queue-4.19/ext4-fix-possible-leak-of-s_journal_flag_rwsem-in-error-path.patch