From: Chao Yu <chao@kernel.org>
To: Gao Xiang <hsiangkao@linux.alibaba.com>,
linux-erofs@lists.ozlabs.org, Yue Hu <huyue2@coolpad.com>,
Jeffle Xu <jefflexu@linux.alibaba.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
syzbot+c3729cda01706a04fb98@syzkaller.appspotmail.com
Subject: Re: [PATCH] erofs: fix kvcalloc() misuse with __GFP_NOFAIL
Date: Mon, 9 Jan 2023 18:34:01 +0800 [thread overview]
Message-ID: <c949dfe9-572f-61ee-a587-1f71be2f13d7@kernel.org> (raw)
In-Reply-To: <cbd4bc97-4ffb-45c5-8c3c-b9b81b20d813@linux.alibaba.com>
On 2023/1/6 13:06, Gao Xiang wrote:
>
>
> On 2023/1/6 11:19, Gao Xiang wrote:
>> As reported by syzbot [1], kvcalloc() cannot work with __GFP_NOFAIL.
>> Let's use kcalloc() instead.
>>
>> [1] https://lore.kernel.org/r/0000000000007796bd05f1852ec2@google.com
>> Reported-by: syzbot+c3729cda01706a04fb98@syzkaller.appspotmail.com
>
> Fixes: fe3e5914e6dc ("erofs: try to leave (de)compressed_pages on stack if possible")
> Fixes: 4f05687fd703 ("erofs: introduce struct z_erofs_decompress_backend")
>
>> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
>> ---
>> fs/erofs/zdata.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
>> index ccf7c55d477f..08e982c77985 100644
>> --- a/fs/erofs/zdata.c
>> +++ b/fs/erofs/zdata.c
>> @@ -1032,12 +1032,12 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
>> if (!be->decompressed_pages)
>> be->decompressed_pages =
>> - kvcalloc(be->nr_pages, sizeof(struct page *),
>> - GFP_KERNEL | __GFP_NOFAIL);
>> + kcalloc(be->nr_pages, sizeof(struct page *),
>> + GFP_KERNEL | __GFP_NOFAIL);
>> if (!be->compressed_pages)
>> be->compressed_pages =
>> - kvcalloc(pclusterpages, sizeof(struct page *),
>> - GFP_KERNEL | __GFP_NOFAIL);
>> + kcalloc(pclusterpages, sizeof(struct page *),
>> + GFP_KERNEL | __GFP_NOFAIL);
How about using kfree instead of kvfree for .decompressed_pages and
.compressed_pages memory release? It's trivial though.
Anyway, feel free to add:
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
>> z_erofs_parse_out_bvecs(be);
>> err2 = z_erofs_parse_in_bvecs(be, &overlapped);
next prev parent reply other threads:[~2023-01-09 10:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-06 3:19 [PATCH] erofs: fix kvcalloc() misuse with __GFP_NOFAIL Gao Xiang
2023-01-06 5:06 ` Gao Xiang
2023-01-09 10:34 ` Chao Yu [this message]
2023-01-09 12:55 ` Gao Xiang
2023-01-10 7:49 ` [PATCH v2] " Gao Xiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c949dfe9-572f-61ee-a587-1f71be2f13d7@kernel.org \
--to=chao@kernel.org \
--cc=hsiangkao@linux.alibaba.com \
--cc=huyue2@coolpad.com \
--cc=jefflexu@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+c3729cda01706a04fb98@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox