Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1854474rwl; Thu, 5 Jan 2023 21:27:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXuJYJrs7drooJGxefwajAqugtQGxBgno5glW2Vcr0otrYYS6kvrQiMS+gzF/HjxvKUq475O X-Received: by 2002:a17:907:8b17:b0:7c1:8ba6:6eaf with SMTP id sz23-20020a1709078b1700b007c18ba66eafmr48704242ejc.5.1672982842541; Thu, 05 Jan 2023 21:27:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672982842; cv=none; d=google.com; s=arc-20160816; b=uDVU6t5/FdE95hAh3Yif105CXpDznNkht7vSxNplDmC0/izONkAFqrdQdVgfY7OaFr J+8W6PYqbLIo+x2O1rpCMVygeojqHSlHt/oLS1Wbc3EJQJc7YBmqd2nuqzQWtebIsXZ9 YgxecoyaMZeXfNasKGg2YS0wKHTn3wi1gLRG/EySz/B0hE4Jtys8le8nZlOamIAa/sAP IMGgZNdmvfZPwL4lVRpZj4gsHoKXr9KnElAxZaSsZ/rIXDQSr3tlLWsjDTtynryYas1y XAZZPeBQFQNDAJDWzGK+zykXMWBVtUeV4ZUYAckeWye73fZNvT2sfssjIpznIblNHWvX TcVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=zrNqz8+/HEPXlrsJbotjSEn+O4ytuK1Z2v5y9Q8rYjg=; b=QlN8nrP7W5e6FewkOE0GagvpDwgzreRTTMwsS5FJsiTei3vmXSv0Z/+NhrED7/9wwo vLz6RTcAZsRmWwY7GV9Bmh6+ne9+hCItqGmPvHgWp7ETqV5UroZLe4XcUzSmGWbDj2Oa nZpHJQ+Pu8wjPOCxcBvvXnMoU6VAGCDjSuuJHgHBW2yZI6PS1qzaRtWqek8eWBZEdjen gL/oYj4bbPeMWku2gXH5NHF1qRpDgQcityLzeP/ZmedUJfOtWmdvGvXu5LJymb+5sd+m hVUDgdPHzpsX8cxV1fknbLOrJTG9BZJiD850Kebu3i+vXyyjK4/05avHzLeWvr3p13WN h7kA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be12-20020a1709070a4c00b007c087110276si240544ejc.151.2023.01.05.21.27.09; Thu, 05 Jan 2023 21:27:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230465AbjAFFGQ (ORCPT + 54 others); Fri, 6 Jan 2023 00:06:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjAFFGN (ORCPT ); Fri, 6 Jan 2023 00:06:13 -0500 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 200F16AD86 for ; Thu, 5 Jan 2023 21:06:10 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VYyGFtH_1672981567; Received: from 30.97.49.39(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VYyGFtH_1672981567) by smtp.aliyun-inc.com; Fri, 06 Jan 2023 13:06:08 +0800 Message-ID: Date: Fri, 6 Jan 2023 13:06:07 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH] erofs: fix kvcalloc() misuse with __GFP_NOFAIL To: linux-erofs@lists.ozlabs.org, Chao Yu , Yue Hu , Jeffle Xu Cc: LKML , syzbot+c3729cda01706a04fb98@syzkaller.appspotmail.com References: <20230106031937.113318-1-hsiangkao@linux.alibaba.com> From: Gao Xiang In-Reply-To: <20230106031937.113318-1-hsiangkao@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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); > > z_erofs_parse_out_bvecs(be); > err2 = z_erofs_parse_in_bvecs(be, &overlapped);