Skip to content

Commit 881d8d5

Browse files
committed
crypto: octeontx2 - Fix cptvf driver cleanup
JIRA: https://issues.redhat.com/browse/RHEL-31478 Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git commit c480a42 Author: Bharat Bhushan <bbhushan2@marvell.com> Date: Mon Dec 11 15:59:11 2023 +0530 crypto: octeontx2 - Fix cptvf driver cleanup 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 <bbhushan2@marvell.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
1 parent a359477 commit 881d8d5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

drivers/crypto/marvell/octeontx2/otx2_cptlf.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,8 @@ int otx2_cptlf_init(struct otx2_cptlfs_info *lfs, u8 eng_grp_mask, int pri,
419419
return 0;
420420

421421
free_iq:
422-
otx2_cpt_free_instruction_queues(lfs);
423422
cptlf_hw_cleanup(lfs);
423+
otx2_cpt_free_instruction_queues(lfs);
424424
detach_rsrcs:
425425
otx2_cpt_detach_rsrcs_msg(lfs);
426426
clear_lfs_num:
@@ -431,11 +431,13 @@ EXPORT_SYMBOL_NS_GPL(otx2_cptlf_init, CRYPTO_DEV_OCTEONTX2_CPT);
431431

432432
void otx2_cptlf_shutdown(struct otx2_cptlfs_info *lfs)
433433
{
434-
lfs->lfs_num = 0;
435434
/* Cleanup LFs hardware side */
436435
cptlf_hw_cleanup(lfs);
436+
/* Free instruction queues */
437+
otx2_cpt_free_instruction_queues(lfs);
437438
/* Send request to detach LFs */
438439
otx2_cpt_detach_rsrcs_msg(lfs);
440+
lfs->lfs_num = 0;
439441
}
440442
EXPORT_SYMBOL_NS_GPL(otx2_cptlf_shutdown, CRYPTO_DEV_OCTEONTX2_CPT);
441443

drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,11 @@ static void cptvf_lf_shutdown(struct otx2_cptlfs_info *lfs)
249249
otx2_cptlf_unregister_interrupts(lfs);
250250
/* Cleanup LFs software side */
251251
lf_sw_cleanup(lfs);
252+
/* Free instruction queues */
253+
otx2_cpt_free_instruction_queues(lfs);
252254
/* Send request to detach LFs */
253255
otx2_cpt_detach_rsrcs_msg(lfs);
256+
lfs->lfs_num = 0;
254257
}
255258

256259
static int cptvf_lf_init(struct otx2_cptvf_dev *cptvf)

0 commit comments

Comments
 (0)