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 1DD6D27713; Tue, 9 Jul 2024 11:24:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720524249; cv=none; b=PqNxHztJOhBLIXnawIk8eyDuVOndcsh865YT9C0Jh1K6dC4+8h7bbfP+d/eri1gfM1NTGadgMvY1EobGKeLPOKQnW9v/0kvhc453yvFLTtmYQc/2mWzvo+EBT11q1CaFpSW5JpvUQrZNwHwQV8+jUwDTWD7dJz3+HVyQ+4tejDY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720524249; c=relaxed/simple; bh=260WXWoIPhdZ9eebVZMQ1/2tYckMgI0aY1mToNUDyos=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S9ECDzWd516RPOtA5uWnF94xTkPUXc2lnIlHPR8gdT33etk+6UhXoW7t8YSnzl5RxcF6K0XvxK6RCsawnrt7BRjCt0M9XCRGwZRqK1hVWSKoSFoA/S4iYMagLMDAhlbisQP38taNjg9MPQvcdMcTkOShWASQ0QIQzzcuQcjTeCU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FKWd/km6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="FKWd/km6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95052C3277B; Tue, 9 Jul 2024 11:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720524249; bh=260WXWoIPhdZ9eebVZMQ1/2tYckMgI0aY1mToNUDyos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FKWd/km61tXAXkj7sdRdO0zXJLGi5F2cYlhDYc9ChmVMRgsX1SHvQc8LVvSlmfit6 jKo7isR3dxpjeaUz5r11t7RxZ9ARyyqqarCw+obbMozlIy2FCa+i/fabGss+U0L152 wGd+CPM6U41XlenTIrKGSkWGKWyVmAQDvHWVVOIc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Przemek Kitszel , Jacob Keller , Karol Kolacinski , Simon Horman , Tony Nguyen , Jakub Kicinski , Sasha Levin , Pucha Himasekhar Reddy Subject: [PATCH 6.9 120/197] ice: Dont process extts if PTP is disabled Date: Tue, 9 Jul 2024 13:09:34 +0200 Message-ID: <20240709110713.595291564@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240709110708.903245467@linuxfoundation.org> References: <20240709110708.903245467@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jacob Keller [ Upstream commit 996422e3230e41468f652d754fefd1bdbcd4604e ] The ice_ptp_extts_event() function can race with ice_ptp_release() and result in a NULL pointer dereference which leads to a kernel panic. Panic occurs because the ice_ptp_extts_event() function calls ptp_clock_event() with a NULL pointer. The ice driver has already released the PTP clock by the time the interrupt for the next external timestamp event occurs. To fix this, modify the ice_ptp_extts_event() function to check the PTP state and bail early if PTP is not ready. Fixes: 172db5f91d5f ("ice: add support for auxiliary input/output pins") Reviewed-by: Przemek Kitszel Signed-off-by: Jacob Keller Signed-off-by: Karol Kolacinski Reviewed-by: Simon Horman Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) Signed-off-by: Tony Nguyen Link: https://patch.msgid.link/20240702171459.2606611-3-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_ptp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index ee741a1d13cf0..e983e56b342b7 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -1578,6 +1578,10 @@ void ice_ptp_extts_event(struct ice_pf *pf) u8 chan, tmr_idx; u32 hi, lo; + /* Don't process timestamp events if PTP is not ready */ + if (pf->ptp.state != ICE_PTP_READY) + return; + tmr_idx = hw->func_caps.ts_func_info.tmr_index_owned; /* Event time is captured by one of the two matched registers * GLTSYN_EVNT_L: 32 LSB of sampled time event -- 2.43.0