Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp156642lqd; Tue, 23 Apr 2024 19:29:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWWHz70/R5JOPE/jrqgo1cGKP6wjdCu6+Rjmkq0ucgmdJ2kC6k4Iu630WWN25nBoWP0CO6d3drcbxLmuBPFz/ZkUd84mx/dxNJu0ldz9w== X-Google-Smtp-Source: AGHT+IEVIYc6doMpDpOMKJ4fDdHtYtOao/2QT7gPkehJAOizPhw9MjzHc7mIw2AUJ7yfozCFZ1z/ X-Received: by 2002:a05:6870:7b50:b0:222:1353:ad0f with SMTP id ji16-20020a0568707b5000b002221353ad0fmr1194395oab.24.1713925761395; Tue, 23 Apr 2024 19:29:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713925761; cv=pass; d=google.com; s=arc-20160816; b=J0YPYjm/N7c013AebyqSQEmjIC03F6gYOsaUQVTwlnQppT4ARvRwVIEgKwac34L5/h swC5hVe4ZcOCwadGnFOn0HMSaQ9exRkKcw9ynID7jxOMWfsLCnaO1h1dnIYy0EjFDzUc NCzpd/l8ZXJcIY+Z09efKl1slyabrnQnNVQHPYSi38LWYkEFUU6fe9t4L11PQIOO4dpe nYUwZSrtKTD7lcZhmkel2uN7BXnR3qY3bH/G7/t1kVLL2wMqzZJVT6GhYEG+PV421y1i 97g8uy80+J1vOlMIM+aT9VxhImFNKVIS0P+LORHSY8weDfWRLON7mv0hOYAdiQGcDwIC VP/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=01Ap72UyRqtfxS+//wH8y2FDTKJGv1UK6zAT/eA1DJ8=; fh=CxVAXWlMYCZiRC6vtV1HVZgaZu0LoqV7OvYHi/3lEO4=; b=TRfJs1hPF4AodDUdyKqTw1cN6erdAEAb798a2SxfW6HMwNvvurOZVjJEtyRaOF1yNt UgDD10Y3WiBx0YFlebp0Xiv8eJCd9PTJaykHPUH2EeDmnvCzoC28halJCwInAyRMc7aD gyWmEvp5aS0oenLRjx+lS/OIpzVrRjHLZLhgIJMn5tfuGHIiRtEnvRGnyR20Z8id9Wd5 QrfZKOuNMWi3Jnaoh2kv4YYHSiB+scmIMhJgoToIAR/uho8sINx80233wieKjb8kul0K J1Xxg0LiFJv8wujGMk0LyeND16omVi/0f9PyvOQSoWdIxGP8GFfARWRCiIoNeuQ5+q5f NOQQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=nfschina.com); spf=pass (google.com: domain of linux-kernel+bounces-156136-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156136-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c25-20020a62e819000000b006ecf6ce1e4esi10140139pfi.230.2024.04.23.19.29.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 19:29:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156136-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=nfschina.com); spf=pass (google.com: domain of linux-kernel+bounces-156136-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156136-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id EB7F4B2154B for ; Wed, 24 Apr 2024 02:28:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A2F91C680; Wed, 24 Apr 2024 02:28:33 +0000 (UTC) Received: from mail.nfschina.com (unknown [42.101.60.195]) by smtp.subspace.kernel.org (Postfix) with SMTP id 6B4F8568A; Wed, 24 Apr 2024 02:28:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=42.101.60.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713925713; cv=none; b=TEWjPUyozSFDvvW/kgSKGLMnJ3iVSxJZNsU6XXDFZaKdvR+ycFRb3IQzyb/Ne1j4xVh0UdNNY7WMAaEljcTYa6vDFmVUzT3HdA8wz5IKMMCRjualxo7cmOCvm65SQwVGX2yDXFA/Pa8iBuISD/QjBwLsxOq725u/xUeycjMf+iw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713925713; c=relaxed/simple; bh=53lcTeRvvpcYAQU46xMUesg77FmlT96Wq1XtqskvJ8Y=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=tKzYh8lyD7xrhFst3H5fHWwswFVG/TsXEpFysyVcw7maRrVHEDkf77jarZey9vZ3akJSf6W4oMhSXHVjoGjg3FzNoP7RdLM+ksviqbRqA2xcS3XWbBqxyyTurkRoT9Swzopp3itcdJRPVmsOV0LZSoTZrqhYE7ATQh/lFOa58QY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com; spf=pass smtp.mailfrom=nfschina.com; arc=none smtp.client-ip=42.101.60.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nfschina.com Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id A58BD6019C09D; Wed, 24 Apr 2024 10:28:12 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: sgoutham@marvell.com, lcherian@marvell.com, gakula@marvell.com, jerinj@marvell.com, hkelam@marvell.com, sbhatta@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, nathan@kernel.org, ndesaulniers@google.com, morbo@google.com, justinstitt@google.com Cc: Su Hui , sumang@marvell.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, kernel-janitors@vger.kernel.org Subject: [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem() Date: Wed, 24 Apr 2024 10:27:25 +0800 Message-Id: <20240424022724.144587-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clang static checker(scan-build) warning: drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c:line 2184, column 2 Attempt to free released memory. npc_mcam_rsrcs_deinit() has released 'mcam->counters.bmap'. Deleted this redundant kfree() to fix this double free problem. Fixes: dd7842878633 ("octeontx2-af: Add new devlink param to configure maximum usable NIX block LFs") Signed-off-by: Su Hui --- drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c index be709f83f331..e8b73b9d75e3 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c @@ -2181,7 +2181,6 @@ void rvu_npc_freemem(struct rvu *rvu) kfree(pkind->rsrc.bmap); npc_mcam_rsrcs_deinit(rvu); - kfree(mcam->counters.bmap); if (rvu->kpu_prfl_addr) iounmap(rvu->kpu_prfl_addr); else -- 2.30.2