From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C417735889; Tue, 16 Jan 2024 00:25:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZKdlVOVN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30CAFC433C7; Tue, 16 Jan 2024 00:25:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705364736; bh=UdYE0nHNwmXd7sXbpftZ31FZV7QPzlGJj9bgF5WtpBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZKdlVOVNMlR+k5AR+tuNt9N4gfUEKaTjSApiujONmIz91+S+ngHCjLDAQaT4Pk9j6 3JdZeN4WBRnnBtDlXci5b66dUTZypIQWXA4VHZHJiiTVt4xRl9XY/eG8s1kfqKR1Yo g3AnLYsD9wssl5hWpTzgaulgIABIPFyK7nCxZfOiVEdgUg+P14oM8qXGPt4OYcmHUW VUBUBhzqgfL3Dy7OjpAfRx1b70tOGy2QZFn8x7knKrsSON/L6RJ7Wwa6H0T4vdS+Iq T7hrltozjsszdYiPAjYJM7oTxBjf5mNVXxo/8dNL/v0nx32YXHs4cR+xx+9kretIqO ObIhNrn605M4A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Bharat Bhushan , Herbert Xu , Sasha Levin , bbrezillon@kernel.org, arno@natisbad.org, schalla@marvell.com, davem@davemloft.net, ndabilpuram@marvell.com, alobakin@pm.me, masahiroy@kernel.org, tj@kernel.org, linux-crypto@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 08/14] crypto: octeontx2 - Fix cptvf driver cleanup Date: Mon, 15 Jan 2024 19:24:50 -0500 Message-ID: <20240116002512.215607-8-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116002512.215607-1-sashal@kernel.org> References: <20240116002512.215607-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.73 Content-Transfer-Encoding: 8bit From: Bharat Bhushan [ Upstream commit c480a421a4faf693c38e60b0fe6e554c9a3fee02 ] This patch fixes following cleanup issues: - Missing instruction queue free on cleanup. This will lead to memory leak. - lfs->lfs_num is set to zero before cleanup, which will lead to improper cleanup. Signed-off-by: Bharat Bhushan Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/marvell/octeontx2/otx2_cptlf.c | 6 ++++-- drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptlf.c b/drivers/crypto/marvell/octeontx2/otx2_cptlf.c index 71e5f79431af..6e4a78e1f3ce 100644 --- a/drivers/crypto/marvell/octeontx2/otx2_cptlf.c +++ b/drivers/crypto/marvell/octeontx2/otx2_cptlf.c @@ -419,8 +419,8 @@ int otx2_cptlf_init(struct otx2_cptlfs_info *lfs, u8 eng_grp_mask, int pri, return 0; free_iq: - otx2_cpt_free_instruction_queues(lfs); cptlf_hw_cleanup(lfs); + otx2_cpt_free_instruction_queues(lfs); detach_rsrcs: otx2_cpt_detach_rsrcs_msg(lfs); clear_lfs_num: @@ -431,11 +431,13 @@ EXPORT_SYMBOL_NS_GPL(otx2_cptlf_init, CRYPTO_DEV_OCTEONTX2_CPT); void otx2_cptlf_shutdown(struct otx2_cptlfs_info *lfs) { - lfs->lfs_num = 0; /* Cleanup LFs hardware side */ cptlf_hw_cleanup(lfs); + /* Free instruction queues */ + otx2_cpt_free_instruction_queues(lfs); /* Send request to detach LFs */ otx2_cpt_detach_rsrcs_msg(lfs); + lfs->lfs_num = 0; } EXPORT_SYMBOL_NS_GPL(otx2_cptlf_shutdown, CRYPTO_DEV_OCTEONTX2_CPT); diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c b/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c index 392e9fee05e8..6f3373f9928c 100644 --- a/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c +++ b/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c @@ -249,8 +249,11 @@ static void cptvf_lf_shutdown(struct otx2_cptlfs_info *lfs) otx2_cptlf_unregister_interrupts(lfs); /* Cleanup LFs software side */ lf_sw_cleanup(lfs); + /* Free instruction queues */ + otx2_cpt_free_instruction_queues(lfs); /* Send request to detach LFs */ otx2_cpt_detach_rsrcs_msg(lfs); + lfs->lfs_num = 0; } static int cptvf_lf_init(struct otx2_cptvf_dev *cptvf) -- 2.43.0