]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ice: dpll: fix rclk pin state get for E810
authorIvan Vecera <ivecera@redhat.com>
Wed, 6 May 2026 21:48:16 +0000 (14:48 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 8 May 2026 23:01:09 +0000 (16:01 -0700)
The refactoring of ice_dpll_rclk_state_on_pin_get() to use
ice_dpll_pin_get_parent_idx() omitted the base_rclk_idx adjustment that was
correctly added in the ice_dpll_rclk_state_on_pin_set() path. This breaks
E810 devices where base_rclk_idx is non-zero, causing the wrong hardware
index to be used for pin state lookup and incorrect recovered clock state
to be reported via the DPLL subsystem. E825C is unaffected as its
base_rclk_idx is 0.

While at it, add bounds check against ICE_DPLL_RCLK_NUM_MAX on hw_idx after
the base_rclk_idx subtraction in both ice_dpll_rclk_state_on_pin_{get,set}()
to prevent out-of-bounds access on the pin state array.

Fixes: ad1df4f2d591 ("ice: dpll: Support E825-C SyncE and dynamic pin discovery")
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20260506-jk-iwl-net-2026-05-04-v2-7-a5ea4dc837a9@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/ice/ice_dpll.c

index 27b460926baced1a02d49a71365c3a9a3f0a83d7..892bc7c2e28b46f9e88dd381937775d0eff00ceb 100644 (file)
@@ -2523,6 +2523,8 @@ ice_dpll_rclk_state_on_pin_set(const struct dpll_pin *pin, void *pin_priv,
        if (hw_idx < 0)
                goto unlock;
        hw_idx -= pf->dplls.base_rclk_idx;
+       if (hw_idx >= ICE_DPLL_RCLK_NUM_MAX)
+               goto unlock;
 
        if ((enable && p->state[hw_idx] == DPLL_PIN_STATE_CONNECTED) ||
            (!enable && p->state[hw_idx] == DPLL_PIN_STATE_DISCONNECTED)) {
@@ -2586,6 +2588,9 @@ ice_dpll_rclk_state_on_pin_get(const struct dpll_pin *pin, void *pin_priv,
        hw_idx = ice_dpll_pin_get_parent_idx(p, parent_pin);
        if (hw_idx < 0)
                goto unlock;
+       hw_idx -= pf->dplls.base_rclk_idx;
+       if (hw_idx >= ICE_DPLL_RCLK_NUM_MAX)
+               goto unlock;
 
        ret = ice_dpll_pin_state_update(pf, p, ICE_DPLL_PIN_TYPE_RCLK_INPUT,
                                        extack);