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 15AD32F60A7; Tue, 17 Mar 2026 17:10:15 +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=1773767415; cv=none; b=to2xkri936M6ZDVCSFA6UOKYGPPyb8KTzQYpxyl8qmvFLU8neQQ4hcZlDoNpt+/qQbubqWU3X/gM6uOtXfoNr7nt+I/XyWBM+GGhD4vq0tmyQg01YUaXFWNDVrQY8CBq+KQHeCLscfqHT1gnIoTU7htpncmnY94KyAkf1mILbbc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773767415; c=relaxed/simple; bh=G1UfVPWgJXlPN5dPkhybqm6AmbcehoNGzc+CqljBvU4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y3NxtOTSSMmuZn5KPQ4TikM+Q1VZWIEkeHFgI8SJcV83MUwxD+FWVtCQl4XLNg7VwgYlR6ifp52FOaQM1UUrnPt3WtKKTaR61J2BLRmBfdlz15OwiHlUa1frE5Ze9bwJg811ZT5n6qLMCq4xdAcL1UFktT0gqJoMZl9Gu1m+kJU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UKxTINbp; 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="UKxTINbp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EBB0C4CEF7; Tue, 17 Mar 2026 17:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1773767415; bh=G1UfVPWgJXlPN5dPkhybqm6AmbcehoNGzc+CqljBvU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UKxTINbpNBH2+57J/TJZSqXJQELVXDuS7NX2J6VenEdAQ4sR8/gD5fmtP1b1dyird cu6f2Kyv3ac9FGe2se1FMEm6FlvWLWhzNE8FnuhHD0QIUpO/hFfh8Dzj7ojcMWuyWT eBKOrybPnQhLrFBx2g9jtv8tuSRsCOMXQEKHRcRs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Petr Oros , Ivan Vecera , Jacob Keller , Vadim Fedorenko , Paul Menzel , Aleksandr Loktionov , Tony Nguyen , Sasha Levin Subject: [PATCH 6.18 082/333] iavf: fix PTP use-after-free during reset Date: Tue, 17 Mar 2026 17:31:51 +0100 Message-ID: <20260317163002.417674704@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260317162959.345812316@linuxfoundation.org> References: <20260317162959.345812316@linuxfoundation.org> User-Agent: quilt/0.69 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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Petr Oros [ Upstream commit efc54fb13d79117a825fef17364315a58682c7ec ] Commit 7c01dbfc8a1c5f ("iavf: periodically cache PHC time") introduced a worker to cache PHC time, but failed to stop it during reset or disable. This creates a race condition where `iavf_reset_task()` or `iavf_disable_vf()` free adapter resources (AQ) while the worker is still running. If the worker triggers `iavf_queue_ptp_cmd()` during teardown, it accesses freed memory/locks, leading to a crash. Fix this by calling `iavf_ptp_release()` before tearing down the adapter. This ensures `ptp_clock_unregister()` synchronously cancels the worker and cleans up the chardev before the backing resources are destroyed. Fixes: 7c01dbfc8a1c5f ("iavf: periodically cache PHC time") Signed-off-by: Petr Oros Reviewed-by: Ivan Vecera Acked-by: Jacob Keller Reviewed-by: Vadim Fedorenko Reviewed-by: Paul Menzel Reviewed-by: Aleksandr Loktionov Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/iavf/iavf_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index 53a0366fbf998..3625c70bc3292 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -3040,6 +3040,8 @@ static void iavf_disable_vf(struct iavf_adapter *adapter) adapter->flags |= IAVF_FLAG_PF_COMMS_FAILED; + iavf_ptp_release(adapter); + /* We don't use netif_running() because it may be true prior to * ndo_open() returning, so we can't assume it means all our open * tasks have finished, since we're not holding the rtnl_lock here. @@ -3215,6 +3217,8 @@ static void iavf_reset_task(struct work_struct *work) iavf_change_state(adapter, __IAVF_RESETTING); adapter->flags &= ~IAVF_FLAG_RESET_PENDING; + iavf_ptp_release(adapter); + /* free the Tx/Rx rings and descriptors, might be better to just * re-use them sometime in the future */ -- 2.51.0