]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ice: fix PTP Call Trace during PTP release
authorPaul Greenwalt <paul.greenwalt@intel.com>
Fri, 17 Jul 2026 18:53:31 +0000 (11:53 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 23 Jul 2026 16:00:50 +0000 (09:00 -0700)
If a PF reset occurs when the PTP state is ICE_PTP_UNINIT, then
ice_ptp_rebuild() will update the state to ICE_PTP_ERROR. This will
result in the following PTP release call trace during driver unload:

    kernel BUG at lib/list_debug.c:52!
    ice_ptp_release+0x332/0x3c0 [ice]
    ice_deinit_features.part.0+0x10e/0x120 [ice]
    ice_remove+0x100/0x220 [ice]

This was observed when passing PF1 through to a VM. ice_ptp_init()
fails because ctrl_pf is NULL and sets the state to ICE_PTP_UNINIT.

Fix by detecting the ICE_PTP_UNINIT state in ice_ptp_rebuild() and
returning without error, preventing the invalid state transition to
ICE_PTP_ERROR. The only valid path to ICE_PTP_ERROR is from
ICE_PTP_RESETTING after a failed rebuild.

Fixes: 8293e4cb2ff5 ("ice: introduce PTP state machine")
Cc: stable@vger.kernel.org
Signed-off-by: Paul Greenwalt <paul.greenwalt@intel.com>
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Link: https://patch.msgid.link/20260717185340.3595286-10-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/ice/ice_ptp.c

index 1469038bc8959481682c8571db4b61ab2a1a2588..eaec36ab6ae3f3447fb8aaf3735f50801319182e 100644 (file)
@@ -3037,6 +3037,11 @@ void ice_ptp_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
        struct ice_ptp *ptp = &pf->ptp;
        int err;
 
+       if (ptp->state == ICE_PTP_UNINIT) {
+               dev_dbg(ice_pf_to_dev(pf), "PTP was not initialized, skipping rebuild\n");
+               return;
+       }
+
        if (ptp->state == ICE_PTP_READY) {
                ice_ptp_prepare_for_reset(pf, reset_type);
        } else if (ptp->state != ICE_PTP_RESETTING) {