Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp826597rdb; Wed, 1 Nov 2023 04:11:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+4lb3cRwRUU//V/wyrDGOB/EI2OEg0c7JTJUIugZOHRZ/m9qKoonCmRTSXPGTS8420qj8 X-Received: by 2002:a17:902:f10a:b0:1cc:3932:4a87 with SMTP id e10-20020a170902f10a00b001cc39324a87mr6545925plb.56.1698837118433; Wed, 01 Nov 2023 04:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698837118; cv=none; d=google.com; s=arc-20160816; b=pnlbmw6kBIbAyOmO1a1jntra9oPkkvC7ZtFatXZhNN4PGZstnFdkH9bUjw6NFowpiZ gAcV27OW0O1U1fD2G+F0CNwve+6EkT+WISZ6V7dL7Qd0gHTbL4kpaDA90M0p9GeQD96i iJx+bh0Q81OzSliOV4zhhpCn78+gWOKKbp0i6Q6lpkSLeTklVi47WlkFTT7eOIzs7r5Z 2TR32m+rZ5aip76x/wCH/M8uuseSbykGdg8i5cGu8FfAPrJ5Nx/L7sEjWeTddCNHZs+w DJXVE3PaVmf1d/jIOR5H1n3xbTpu41Nz6YI8rhAtIVzPSK5lvvGGDQ/JheTCtbyeOGrl xbrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=WljMIn9oOVQ8xvgl/cyiqAsCMw6Ur1FNTMuZ2oBE+gw=; fh=03jNThriU6XOTTy2tygdOtDRQov4fKuGeE6Z6/bpP7Y=; b=cqGwBsyv5LGCqBWsGldqJwg8ynBs31sE3NWFSjFpUyxoAzfXfxy2uVFFnJUJzT7PGZ PIwfPyuoPlGSYAEqejieWe67QM9xFmop3HN9LAChoVgYhFrbybOo34MIuRGPAnxsm4b1 uGj0AWq8WZGj09R11SAZZv6X+VBUdQDP7A4DQctj4Tlr2FeVchndGvXQsR5UsfTW8gYm jdoczGTM1d87TqF3J1YK8Uvrh3BqVtDfOKyGX1hiHXE+aFCOXeq8TFGhaKhv5D2bQllS i0phDX2VGmYToj0FGZ76Mvb1icIBy9UL47RkkjHC6bUjWNYas4E5VOpkQ0YdrmbSVA2L nXBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EiD8IRTA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id f13-20020a170902ce8d00b001c7388413besi2902443plg.529.2023.11.01.04.11.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 04:11:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EiD8IRTA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6D3038028A77; Wed, 1 Nov 2023 04:11:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233467AbjKALL4 (ORCPT + 99 others); Wed, 1 Nov 2023 07:11:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231796AbjKALLz (ORCPT ); Wed, 1 Nov 2023 07:11:55 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1139DFC for ; Wed, 1 Nov 2023 04:11:48 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2c514cbbe7eso92461161fa.1 for ; Wed, 01 Nov 2023 04:11:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698837106; x=1699441906; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=WljMIn9oOVQ8xvgl/cyiqAsCMw6Ur1FNTMuZ2oBE+gw=; b=EiD8IRTAcbxeZLYteg296XQlerco54RyGGC+tc6wu+uf5ffFOII7WNDwO2r1fX3SgT Y4PUBMiM/6wO7lvP1iV58KZ2I/9TTChZTs95P6/wO9YIBnR67LSCdUcEmT2LXDua3WE3 xTk/OkowTg0E3mtN8aAmYKSHiJicRRWEwiJNjVnJEKsbfyJsKEuR7b06d/jfFvHyaIR6 RzrIYtBiUasApFXhkIaZMHOetSZR8WBdQNxpcP9sB5ZkwojWRhCvpIFkAJICl560Fqis mEANTNW+QdYkKaETOi0ljA5SoTF36ReJayvLZ+wXtrQIwEjmkL4e3IAAa1gN+BYRK2QY B3BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698837106; x=1699441906; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WljMIn9oOVQ8xvgl/cyiqAsCMw6Ur1FNTMuZ2oBE+gw=; b=lKydDqmxVgyUMorSX09gCesW/U1ItpA65xTmfIXjpHF82rib5CdTbHuK76RbgpTu0s Tn476S4PA43UuuBuUxNUs3bQNVKmKkve+/yClDRH7bYEGpwwj7oQyHZdGzM/qKUeVoEV zXugv2YR8MhaszU1ucQYAl90Llmpa+MRfrlcLDTtVen4Wfe7UtFuaE7R9mumop6/rZnq cl7okJbGSzwuuBvzTlEBb8EOlDUH1tLYWS2SnZsaiA2qbm1skiSCvNZ4ntVlOZZPg3K5 vxzdV9A8JaS7fqYgVYkAU6kF/jhyMKevL8HTJ9vdHoprAj65K/1cjgKoi6gkvb3VdWLK gusg== X-Gm-Message-State: AOJu0YwzzfyoNVvQINNzqbUtD/B6mUU1mG408cuV7/pq9YVIW9UiuZAl 68bZ5Maw1VPJ9WPfWBCLhQlbnTCv4S9cdyzLoedQFA== X-Received: by 2002:ac2:4846:0:b0:507:aaa4:e3b3 with SMTP id 6-20020ac24846000000b00507aaa4e3b3mr10709203lfy.50.1698837106260; Wed, 01 Nov 2023 04:11:46 -0700 (PDT) MIME-Version: 1.0 References: <20231030091256.2915394-1-shaojijie@huawei.com> In-Reply-To: <20231030091256.2915394-1-shaojijie@huawei.com> From: Ilias Apalodimas Date: Wed, 1 Nov 2023 13:11:10 +0200 Message-ID: Subject: Re: [PATCH net] net: page_pool: add missing free_percpu when page_pool_init fail To: Jijie Shao Cc: hawk@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jdamato@fastly.com, shenjian15@huawei.com, wangjie125@huawei.com, liuyonglong@huawei.com, linyunsheng@huawei.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 01 Nov 2023 04:11:57 -0700 (PDT) On Mon, 30 Oct 2023 at 11:17, 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. > > 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); > > -- > 2.30.0 > Reviewed-by: Ilias Apalodimas