Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp173049pxp; Fri, 11 Mar 2022 01:45:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhoFQwVRmNTg9b+zY0XMGhgXqpkgJZKGbAOTSYocuEyEXr4aHfm9k46m6DJFo9wFGGQmxY X-Received: by 2002:a05:6402:424f:b0:416:2b29:7e27 with SMTP id g15-20020a056402424f00b004162b297e27mr8104787edb.250.1646991956221; Fri, 11 Mar 2022 01:45:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646991956; cv=none; d=google.com; s=arc-20160816; b=opKjCjv148eMYXsdeEl5wpZETFxurZwFHBeUcKf5fIaU5CYglpbL1MysyaokCSOuoA LdKh3Bi1Wkifq4V3d6wHyXa8ohul3hjIG1ThlKb4Xk7Y3W0fzfevCMN2kriiFmtg0P4e +CeOPuZX9M71q1kGqcED6235PslLtaufxFY9Wx/O6KfrNexWp+Z1COaiGRe5LcXfSK8F BZa7YP5m4TZHl2E5pqHuWCfW0MBNftqRaETOo8AMWC1WkIa6klXZBmdCD6pNi8Ooe6/6 BdZcbZU7Oi1liTUwYZdQfCuzUR/A5h2LVZNB0usdGoNcH559F9np9IIOJ29F6XdLzOws bdhQ== 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 :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=L4X9WAi4UrtXy/IuOR2gZdmJr8rcIf2YTgMyDW+yf5g=; b=wEtE98MCRu064CKBubswxGrZ/GnNWExuB4F3IkveICs02ciEq8Zm00P1b4jLtgYvsL k6xjd21PQrNcYrD0mIVNUCH+Q/n2g4Z0JwbbblNiCq5cm7Ypv1Gb6hVZuOQ+oi88T44z cb/ohUfbLPIZuVTzZPoYbv02fGfZ2jn8m16uGgx83/TGvh0eKpoKkyl/Iyr37N0EO9Iv USuazF/JTMBtTFTQxXjtmCC03VpDAtT8DRfonKWrigDqwfdWCIzk14m1wOe0kTFUOFXS kA0z6LbwSL+UZXSQ9rI8rporEWNpUsBvEnxtqATzC15H9e5xZ793VoH7Qpwihm6MT2Nt raiQ== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ky7-20020a170907778700b006cf9ccc9505si4459634ejc.40.2022.03.11.01.45.33; Fri, 11 Mar 2022 01:45:56 -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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240449AbiCJIfs (ORCPT + 99 others); Thu, 10 Mar 2022 03:35:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240412AbiCJIfo (ORCPT ); Thu, 10 Mar 2022 03:35:44 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 752846C953 for ; Thu, 10 Mar 2022 00:34:38 -0800 (PST) Received: from dggpeml500020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KDj0p1RvYzcb1c; Thu, 10 Mar 2022 16:29:46 +0800 (CST) Received: from [10.174.177.174] (10.174.177.174) by dggpeml500020.china.huawei.com (7.185.36.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 10 Mar 2022 16:34:36 +0800 Subject: Re: [PATCH -next v3 0/2] jffs2: fix two memory leak when mount jffs2 To: , , , CC: , Baokun Li References: <20220114102854.3399585-1-libaokun1@huawei.com> From: "libaokun (A)" Message-ID: Date: Thu, 10 Mar 2022 16:34:35 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <20220114102854.3399585-1-libaokun1@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.174] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500020.china.huawei.com (7.185.36.88) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 A gentle ping, sorry for the noise. 在 2022/1/14 18:28, Baokun Li 写道: > V1->V2: > In jffs2_scan_medium, > if s = kzalloc(sizeof(struct jffs2_summary), GFP_KERNEL); > returns error, go to "out" to do clear. Null pointer dereference > occurs when if (s->sum_list_head) is executed in "out". > > V2->V3: > Sorry for the noise, but there seems to be a more elegant way to > fix the memory leak in jffs2_scan_medium. When memory allocation > fails or CONFIG_JFFS2_SUMMARY is N, s is NULL.For the former case, > add the new tag "out_buf" to avoid it.In the latter case, > jffs2_sum_reset_collected is also an empty function and does nothing. > > Baokun Li (2): > jffs2: fix memory leak in jffs2_do_mount_fs > jffs2: fix memory leak in jffs2_scan_medium > > fs/jffs2/build.c | 4 +++- > fs/jffs2/scan.c | 6 ++++-- > 2 files changed, 7 insertions(+), 3 deletions(-) > -- With Best Regards, Baokun Li