lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 9 Jan 2023 18:34:01 +0800
From:   Chao Yu <chao@...nel.org>
To:     Gao Xiang <hsiangkao@...ux.alibaba.com>,
        linux-erofs@...ts.ozlabs.org, Yue Hu <huyue2@...lpad.com>,
        Jeffle Xu <jefflexu@...ux.alibaba.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        syzbot+c3729cda01706a04fb98@...kaller.appspotmail.com
Subject: Re: [PATCH] erofs: fix kvcalloc() misuse with __GFP_NOFAIL

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@...kaller.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@...ux.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@...nel.org>

Thanks,

>>       z_erofs_parse_out_bvecs(be);
>>       err2 = z_erofs_parse_in_bvecs(be, &overlapped);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ