Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1043742pxb; Thu, 17 Feb 2022 22:29:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxX1F832zc8J12wtGb+zaZywjIbMpuTzhyg/j+0uDjzwqbY+vYVlWkk0iLDtjZjTWMYu3gM X-Received: by 2002:a05:6a00:b51:b0:4c7:c1a3:3911 with SMTP id p17-20020a056a000b5100b004c7c1a33911mr6544053pfo.13.1645165796831; Thu, 17 Feb 2022 22:29:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645165796; cv=none; d=google.com; s=arc-20160816; b=S+P3pBhfEH7Um3ZkJ+efM7VYElNsztSGz2Fc63pkCSXVgB27/mSM6XgUN1b0DzSrDo hCU78K0oN2R9SYEhe8WIkCAZXixBQ4tPJKyrF3xqd+qcyEj7aDeBcJkRp/YUG4LaH+sP /slQPROlORLd4QFqdujOuVNETuAYD5MzdryOx8y/PFUg2fGKeQdSAUQ+cR/mic9Y8l3t u+Cwi47JqsMt2dcvrfXp+LKevoVvplM4I/DccVa+X0o7yDOE3Pq+cGrUsGARl1MMIZz4 5lA7TJrydRhMNK4OL2jx5Ms+Mz+KsjgidBWNN1i5d3vPdOTJMUYyEjUNOLl1RELJwwFV wfAA== 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=Qrf6MkYS3q7T9XT2sKt7PZ7Mp8b16n9bzOcoZVSfCKo=; b=mFB7vZ42VMMfwuwe0pWgZMTi4uzB4O61pLTZJq5aIz0tfEAMkWPcvmwJ6wsOsSYtLG t40dHjjxJE4lW4oWSHTQM4uD+GsUBAPYGtdxYalyLJ2YrvtKnftHetJHwgCvCdQqaAHs Jnu9ZHrp8PeYeeqGuwjrw5tdtZdxoRdy3S2QFD+ULfSMBacFmTBo3KQ4PVjBN6SH5yn1 MEmJiuk3WQKZP4pnVRC64eUfILjliHHi0ToGyrtKxCzi0HKGxa7r0c4TfZa76iihb91V kB3OnxhIX27tagrlX6xMD5sdyXq449KHNWdrPKznag9qHxhamJUJxpMPoB8vEKYnehaq 4MjA== 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 x15si23617637plg.314.2022.02.17.22.29.43; Thu, 17 Feb 2022 22:29: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 S231263AbiBRGOg (ORCPT + 99 others); Fri, 18 Feb 2022 01:14:36 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230354AbiBRGOf (ORCPT ); Fri, 18 Feb 2022 01:14:35 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 075A14474B for ; Thu, 17 Feb 2022 22:14:18 -0800 (PST) Received: from dggpeml500020.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4K0Lrc6tsGzZfjP; Fri, 18 Feb 2022 14:09:52 +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; Fri, 18 Feb 2022 14:14:16 +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: <807c22e0-4d0d-c658-87f7-06689833e578@huawei.com> Date: Fri, 18 Feb 2022 14:14:16 +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="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.174] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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 ?? 2022/1/14 18:28, Baokun Li ะด??: ping > 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(-) >