Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2612072rdh; Mon, 30 Oct 2023 02:31:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHOnKARXyRlCB9TKvKRdj4oInfmDD9a45akWuWIha9tbRhWiWjoUXLcHN2OsvHBfsV6cTNb X-Received: by 2002:a05:6870:f814:b0:1ef:b949:3f5a with SMTP id fr20-20020a056870f81400b001efb9493f5amr4446683oab.4.1698658303735; Mon, 30 Oct 2023 02:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698658303; cv=none; d=google.com; s=arc-20160816; b=kZOzJchVk3zWBoWmaKwVaoAIrUNDnzuSfIRtljWpox+TJbsOoi/iw97qWA7NVTQezC UNZXWDR0h6mgL4AndxUCptciPu/nlqduiWvvjQO4tcYPOb9sNYaEe4caj5gEnCFVan4A q2VSX88rtZvTXUzchg4e9ISmLFQUvH9Zv0ROsRaI6bs6L0sygXueNrHtQbfxmh2f1jip 6VDj8OhGgEAJ0yeb1YWF9fkcYl9O6hzxRLYxznlYe1tjQnZJ4jSQIzJI6B2mYMvFp1uF 753K1N7CCJoihLmwzmOzuB8v4/hZtIUlPiF1jM66B3Pi/98H2+wgQqr+AFlp8GTVaJim OXHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=V/Ae9SFdSi9EKFfPodnk2PzzVceouE/h5xn1eJ9WJgc=; fh=IC6laDXqlR8prjzcUW7EK2YriNxUH5Cd6lWoEYvpDSo=; b=oMUbv2rmHIS6ejUgEFfDKHVA/IHzSSGzoZPH3GDeEGE7EmoaONcxgebTJMvW5vF4u7 PUT6ZOnYWU+MKCwkB7m/gPqZ8e2TdeN7gk0sL0c+9VkSKczf/X+m1CGp/y2O9MIXygKe KjOoxJomoi3CbyynAS5VSnteUIg/M7HAdoV2WZ8U2SuQM8O3B78snu7cWEPdaWRqmzMu qzY7J0tE2DW4GVypUBwHLdgpNLRkCn+1+Lh4GES+Nz2pS8H4rwpl+WFbWJSA2QKOtJcQ xJ+HDwwzt61qrFmi5ZgoDkm9ubVzga81R9ONS7sR2DMREMVbBgvIlJ2H3OxgLexn0fOz Taug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id s140-20020a632c92000000b0057823b96685si4721159pgs.681.2023.10.30.02.31.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 02:31:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 4C9B980A1390; Mon, 30 Oct 2023 02:31:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232240AbjJ3Jbe (ORCPT + 99 others); Mon, 30 Oct 2023 05:31:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232375AbjJ3Jbc (ORCPT ); Mon, 30 Oct 2023 05:31:32 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D80D8C6; Mon, 30 Oct 2023 02:31:28 -0700 (PDT) Received: from dggpemm500005.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SJnvn0FsDzvQJQ; Mon, 30 Oct 2023 17:26:29 +0800 (CST) Received: from [10.69.30.204] (10.69.30.204) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 30 Oct 2023 17:31:26 +0800 Subject: Re: [PATCH net] net: page_pool: add missing free_percpu when page_pool_init fail To: Jijie Shao , , , , , , , CC: , , , , References: <20231030091256.2915394-1-shaojijie@huawei.com> From: Yunsheng Lin Message-ID: Date: Mon, 30 Oct 2023 17:31:26 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20231030091256.2915394-1-shaojijie@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.2 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 30 Oct 2023 02:31:41 -0700 (PDT) On 2023/10/30 17:12, Jijie Shao wrote: > From: Jian Shen > > When ptr_ring_init() returns failure in page_pool_init(), free_percpu() > is not called to free pool->recycle_stats, which may cause memory > leak. LGTM. Reviewed-by: Yunsheng Lin > > Fixes: ad6fa1e1ab1b ("page_pool: Add recycle stats") > Signed-off-by: Jian Shen > Signed-off-by: Jijie Shao > --- > net/core/page_pool.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/net/core/page_pool.c b/net/core/page_pool.c > index 77cb75e63aca..31f923e7b5c4 100644 > --- a/net/core/page_pool.c > +++ b/net/core/page_pool.c > @@ -221,8 +221,12 @@ static int page_pool_init(struct page_pool *pool, > return -ENOMEM; > #endif > > - if (ptr_ring_init(&pool->ring, ring_qsize, GFP_KERNEL) < 0) > + if (ptr_ring_init(&pool->ring, ring_qsize, GFP_KERNEL) < 0) { > +#ifdef CONFIG_PAGE_POOL_STATS > + free_percpu(pool->recycle_stats); > +#endif > return -ENOMEM; > + } > > atomic_set(&pool->pages_state_release_cnt, 0); > >