Patch "erofs: Revert "erofs: fix kvcalloc() misuse with __GFP_NOFAIL"" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    erofs: Revert "erofs: fix kvcalloc() misuse with __GFP_NOFAIL"

to the 6.1-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:
     erofs-revert-erofs-fix-kvcalloc-misuse-with-__gfp_no.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 25d56dae17aa91811ea6d7e705a6cc19a78506fc
Author: Gao Xiang <xiang@xxxxxxxxxx>
Date:   Thu Mar 9 13:31:47 2023 +0800

    erofs: Revert "erofs: fix kvcalloc() misuse with __GFP_NOFAIL"
    
    [ Upstream commit 647dd2c3f0e16b71a1a77897d038164d48eea154 ]
    
    Let's revert commit 12724ba38992 ("erofs: fix kvcalloc() misuse with
    __GFP_NOFAIL") since kvmalloc() already supports __GFP_NOFAIL in commit
    a421ef303008 ("mm: allow !GFP_KERNEL allocations for kvmalloc").  So
    the original fix was wrong.
    
    Actually there was some issue as [1] discussed, so before that mm fix
    is landed, the warn could still happen but applying this commit first
    will cause less.
    
    [1] https://lore.kernel.org/r/20230305053035.1911-1-hsiangkao@xxxxxxxxxxxxxxxxx
    
    Fixes: 12724ba38992 ("erofs: fix kvcalloc() misuse with __GFP_NOFAIL")
    Reviewed-by: Chao Yu <chao@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230309053148.9223-1-hsiangkao@xxxxxxxxxxxxxxxxx
    Signed-off-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index ee7c88c9b5afa..cf4871834ebb2 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -1047,12 +1047,12 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
 
 	if (!be->decompressed_pages)
 		be->decompressed_pages =
-			kcalloc(be->nr_pages, sizeof(struct page *),
-				GFP_KERNEL | __GFP_NOFAIL);
+			kvcalloc(be->nr_pages, sizeof(struct page *),
+				 GFP_KERNEL | __GFP_NOFAIL);
 	if (!be->compressed_pages)
 		be->compressed_pages =
-			kcalloc(pclusterpages, sizeof(struct page *),
-				GFP_KERNEL | __GFP_NOFAIL);
+			kvcalloc(pclusterpages, sizeof(struct page *),
+				 GFP_KERNEL | __GFP_NOFAIL);
 
 	z_erofs_parse_out_bvecs(be);
 	err2 = z_erofs_parse_in_bvecs(be, &overlapped);
@@ -1100,7 +1100,7 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
 	}
 	if (be->compressed_pages < be->onstack_pages ||
 	    be->compressed_pages >= be->onstack_pages + Z_EROFS_ONSTACK_PAGES)
-		kfree(be->compressed_pages);
+		kvfree(be->compressed_pages);
 	z_erofs_fill_other_copies(be, err);
 
 	for (i = 0; i < be->nr_pages; ++i) {
@@ -1119,7 +1119,7 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
 	}
 
 	if (be->decompressed_pages != be->onstack_pages)
-		kfree(be->decompressed_pages);
+		kvfree(be->decompressed_pages);
 
 	pcl->length = 0;
 	pcl->partial = true;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux