From patchwork Tue Oct 18 05:33:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manank Patel X-Patchwork-Id: 3949 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1789264wrs; Mon, 17 Oct 2022 22:41:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SHeUzs43/EaNigsTUSDdNMkW29GSZcmHhcy0ZWIwpNgxtkeE0yldXWpyaF7RBK8Wt6tXv X-Received: by 2002:a17:90a:5308:b0:20b:1eae:c94e with SMTP id x8-20020a17090a530800b0020b1eaec94emr37225997pjh.88.1666071707841; Mon, 17 Oct 2022 22:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666071707; cv=none; d=google.com; s=arc-20160816; b=dDTgXKN53Din+PL4Ftp6tLK+0m6W/89Afekq6OoSncEBNOi9nZi1lYjq8JAzoMlYZA 6K0S0uiyHtNmmqauE022ZJJA1ZqWyUDy7Yd7LfN/PGl5uv+dDC/jCeyUxDCNwOycjfGN 0ureTp5mZ7DBdm4J/av3rURNHtj+BFSoIW5VwRUFf9SnlZ6HKQszfJ8SFwd+W9BdzaoY 6HI9CgsEvk65RVK0LKwEnf37Ee6gT9Cjfj3Vqqcid4MCY8XFrkxsH7EROZYIQZdLHAVp AAG3C6P0QlhxM/3M/7UexSt5JfDBE+AyErtnn396OFLVSGQr4c1zUuS+18pQ9EAuaiuS G3Bw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a056a00114300b0054116441045si14756435pfm.281.2022.10.17.22.41.35; Mon, 17 Oct 2022 22:41:47 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746963738458154441?= X-GMAIL-MSGID: =?utf-8?q?1747002807363899917?= 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); }