Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5501150rwi; Mon, 17 Oct 2022 23:13:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6CLW6ryLaeaFfj7Tt+TxAT/OenVfDdH/TjRfqWKPgk0TbhcoYerxt2O1kxlBmRhwEYCgy2 X-Received: by 2002:a05:6402:358e:b0:45c:aa8b:f7e9 with SMTP id y14-20020a056402358e00b0045caa8bf7e9mr1174646edc.33.1666073591976; Mon, 17 Oct 2022 23:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666073591; cv=none; d=google.com; s=arc-20160816; b=DX8rl9t1yejQhj+oFKRrettP9kTxz5Ywn/3TrsE1L1lNcjQF3UR/nKrh/4p4Odyakp c5ewIuykqZ1U9DYDlvltRR/h9MOdB6bZLDxB3Zv5x32Lsgr+sz85iUoHxgaol+eAPzte xTNengoGvcxMMotXOP+Uyzxqq75AjVFSvvUewh4nwMlF1B5ZPgqDOv/ZfTpqfESAS7y4 burzjmxz3oK2aMnawbC7MmeuYs0u7kJub78+qawZUzb2Z86OJRwP7OYeqKBQk/4Jrkd7 60OBOabKklFTSLJq3DbWAcbp0aleIZDHWUkwAf9iyT8+VWeZ2mkW0NWpMMLXee0NP+uf QUoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=o+oImAqUi4TycUnQDZjAUtxnRF+A1Z+mDlOgFraFVAI=; b=S2Ey4xYhoLTJEw4S23TTgmwymCdHQtR8YEjYzz6QyJGw7GJn3wZeV6EsvbwuR14iSa Mu2jTUj+S7XHTcUQyZpI2Slam5SQmtzsHpA24GWzSfTIKGLRhZ2+qDGO8wPZYekqM+Zk hK63ORMkzm5vpiqGmVj3aQ35Lx9iyHdYUSMhc41gh3DaqiV+yy/O2RHYaOs2hFoBoQIe 2VQmjmU/5kem8In0eROQAScSpLvEYdn7bJmG7L7+sAITHPfgHicsFxPfW/4VCNuxtQCJ jmA7Y1a7gGmJBlxbIMvkTq+whCUTelLFAjCwg+GYAAng5hor6kPKEYbW9pPfDMVZiDbQ DMQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="L1yIl/Su"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn19-20020a17090794d300b0078a802cce5dsi10698583ejc.592.2022.10.17.23.12.44; Mon, 17 Oct 2022 23:13:11 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b="L1yIl/Su"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230201AbiJRFeE (ORCPT + 99 others); Tue, 18 Oct 2022 01:34:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbiJRFeC (ORCPT ); Tue, 18 Oct 2022 01:34:02 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5230F98349; Mon, 17 Oct 2022 22:34:01 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id p14so13115522pfq.5; Mon, 17 Oct 2022 22:34:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o+oImAqUi4TycUnQDZjAUtxnRF+A1Z+mDlOgFraFVAI=; b=L1yIl/Sue5u90YPFN5ors2MuFXNZ6H2mucAk6Ya4TgUp42FMCUh/B2RHLvDdNp/Lmw GicCot03vuYGlB5tm4y9o4azJNxnUJne8HNrZ4SW89IjaJ46NmmLfGSkIYnpf/C5UfGG 4MvFZid+6jWa4pqSO/xVcIc+NvILy2jw40NBRIQZRCZU/9JsIBwggz9//JxJ+0utdadW 1ITjFvJ0GZP6imyGSztKP9pE3cl2B6H7IRDIIkNroCmKZO6xAeWkkGmrFJ8o7pUZl4yA zB+nDM0VAW7UzwYQiYUQ7yCSqSbkcPwIERlram/AoqF3dneDBaefL3N48nr111VJiGl7 E/Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o+oImAqUi4TycUnQDZjAUtxnRF+A1Z+mDlOgFraFVAI=; b=rmppm4XlCvzaFWo3lKiONIFnLeOo9rOpYP9JTC4WMJel7F5xg4Vcp/gbPR30jcpBV6 5TEfJrZc2REysgz1ojfSeFQ/NjCjRho6R60nZQvSSqqVoszIwY6oXKn3NTcEE1sq2g5b xRCW/peqPpyf/jjVDOR+5XBiZo5jmZNPtQ7m1wkxG671HMkcgj1rYV/NeThFb0poMEO2 hYNzDmf+v6N6/Dez/gjQDqt+VbqQpYceAT7YbZ07VjGWz95EZ62QpM9XWKVDXqK/HHc9 UImiP9kv52DAhJIwo6N6svHVkMCfDQEg3ipz29kTsgx6LODT3c9T0kvbMS9LC/9ROUNs qOhg== X-Gm-Message-State: ACrzQf2PBzFFGDAoNHQKfwyyoLyeUst4EwrccQTh+LWMIACFjg38RMP2 twVaa6nxQWq1fZuSPoVWdJU= X-Received: by 2002:a63:5b05:0:b0:460:a6a:ec38 with SMTP id p5-20020a635b05000000b004600a6aec38mr1210011pgb.485.1666071240786; Mon, 17 Oct 2022 22:34:00 -0700 (PDT) Received: from localhost ([115.117.107.100]) by smtp.gmail.com with ESMTPSA id f5-20020aa79d85000000b005637e5d7770sm8049644pfq.219.2022.10.17.22.33.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 22:34:00 -0700 (PDT) From: Manank Patel To: sgoutham@marvell.com Cc: gakula@marvell.com, sbhatta@marvell.com, hkelam@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, sundeep.lkml@gmail.com, Manank Patel Subject: [PATCH v2] ethernet: marvell: octeontx2 Fix resource not freed after malloc Date: Tue, 18 Oct 2022 11:03:18 +0530 Message-Id: <20221018053317.18900-1-pmanank200502@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 fix rxsc and txsc not getting freed before going out of scope Fixes: c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading") Signed-off-by: Manank Patel --- Changelog v1->v2: add the same fix in cn10k_mcs_create_txsc drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c index 9809f551fc2e..9ec5f38d38a8 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c @@ -815,6 +815,7 @@ static struct cn10k_mcs_txsc *cn10k_mcs_create_txsc(struct otx2_nic *pfvf) cn10k_mcs_free_rsrc(pfvf, MCS_TX, MCS_RSRC_TYPE_FLOWID, txsc->hw_flow_id, false); fail: + kfree(txsc); return ERR_PTR(ret); } @@ -870,6 +871,7 @@ static struct cn10k_mcs_rxsc *cn10k_mcs_create_rxsc(struct otx2_nic *pfvf) cn10k_mcs_free_rsrc(pfvf, MCS_RX, MCS_RSRC_TYPE_FLOWID, rxsc->hw_flow_id, false); fail: + kfree(rxsc); return ERR_PTR(ret); } -- 2.38.0