Skip to content

Commit deb8eb3

Browse files
Kalesh APkuba-moo
authored andcommitted
bnxt_en: Fix a possible memory leak in bnxt_ptp_init
In bnxt_ptp_init(), when ptp_clock_register() fails, the driver is not freeing the memory allocated for ptp_info->pin_config. Fix it to unconditionally free ptp_info->pin_config in bnxt_ptp_free(). Fixes: caf3eed ("bnxt_en: 1PPS support for 5750X family chips") Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20251104005700.542174-3-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent bc7208c commit deb8eb3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,9 +1051,9 @@ static void bnxt_ptp_free(struct bnxt *bp)
10511051
if (ptp->ptp_clock) {
10521052
ptp_clock_unregister(ptp->ptp_clock);
10531053
ptp->ptp_clock = NULL;
1054-
kfree(ptp->ptp_info.pin_config);
1055-
ptp->ptp_info.pin_config = NULL;
10561054
}
1055+
kfree(ptp->ptp_info.pin_config);
1056+
ptp->ptp_info.pin_config = NULL;
10571057
}
10581058

10591059
int bnxt_ptp_init(struct bnxt *bp)

0 commit comments

Comments
 (0)