From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 207DCD358FD for ; Thu, 29 Jan 2026 11:08:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id D7D8E60877; Thu, 29 Jan 2026 11:08:12 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id wT6qDxLHhTQx; Thu, 29 Jan 2026 11:08:11 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 2345A60866 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1769684891; bh=ntbgkhKtRWARdssn5Y+QqDqVGEcBIsUot1MZAzH7HLI=; h=Date:To:References:From:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=6U8Jihe6fu+BojOonSWlb4VC6NuZ42bq5aLxTX4GIhVxhywrjbwZPXMdPkkC3drDu zr9A3/nFt4rhh2pUiebLfRY3jPlF9Px8WSHGxaE0JJFBn7OA61bXS+Hgbq7dvRlM0d ujbuBZOGnWrnBuX3qNsyduayyATBuJELa5c1Z462RKkAUI1SvBzdAn0lVuRSJeS6HG YUQvUF6OuOOab8XwBGaUhW7130+qDxV6ZVVMF4OMVd4LVydW6qwYOXGClJd51Acaow rYqdBJdet7DuYV/yeXnsDSnfZeqO/qGEBu1bHfdyX2U/B3r3qTvDa5US4yy2g4cNjn 8YOCKiHVO8EOg== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 2345A60866; Thu, 29 Jan 2026 11:08:11 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists1.osuosl.org (Postfix) with ESMTP id 74B03118 for ; Thu, 29 Jan 2026 11:08:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6430483BE7 for ; Thu, 29 Jan 2026 11:08:09 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id gz3j999rp3sm for ; Thu, 29 Jan 2026 11:08:08 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=ivecera@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 3154183BE4 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 3154183BE4 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 3154183BE4 for ; Thu, 29 Jan 2026 11:08:06 +0000 (UTC) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-648-Ni2U2sqlMfOumndh9SsP-A-1; Thu, 29 Jan 2026 06:08:02 -0500 X-MC-Unique: Ni2U2sqlMfOumndh9SsP-A-1 X-Mimecast-MFC-AGG-ID: Ni2U2sqlMfOumndh9SsP-A_1769684880 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A68FE1956060; Thu, 29 Jan 2026 11:07:59 +0000 (UTC) Received: from [10.43.2.2] (unknown [10.43.2.2]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DDE953000218; Thu, 29 Jan 2026 11:07:55 +0000 (UTC) Message-ID: <544fac80-d2d9-4895-951d-2201d7ebdc8e@redhat.com> Date: Thu, 29 Jan 2026 12:07:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Petr Oros , netdev@vger.kernel.org References: <20260129095723.7269-1-poros@redhat.com> Content-Language: en-US From: Ivan Vecera In-Reply-To: <20260129095723.7269-1-poros@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769684885; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ntbgkhKtRWARdssn5Y+QqDqVGEcBIsUot1MZAzH7HLI=; b=PtILpjMRq/0KOG46UMzyMf3jpi41jf5WbkvWeeCCc6XD/UCDN7ptmKQwGO8fVQ7pslVDAa TaPYSc6/XKYdQ/Dkswol95krNeRHWR8Ui/34r5KzryD7XKm+6aLFfq/EfCZ4imTcDkozOJ 2mFbiCMlwHhDROPLJSrLoWYO0liSVw8= X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PtILpjMR Subject: Re: [Intel-wired-lan] [PATCH net] iavf: fix PTP use-after-free during reset X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Przemek Kitszel , Richard Cochran , linux-kernel@vger.kernel.org, Andrew Lunn , Eric Dumazet , Tony Nguyen , Simon Horman , Mateusz Polchlopek , Jacob Keller , Jakub Kicinski , Paolo Abeni , "David S. Miller" , intel-wired-lan@lists.osuosl.org Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On 1/29/26 10:57 AM, Petr Oros wrote: > 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 > --- > 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 4b0fc8f354bc90..0dd58ce5a53ab1 100644 > --- a/drivers/net/ethernet/intel/iavf/iavf_main.c > +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c > @@ -3025,6 +3025,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. > @@ -3200,6 +3202,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 > */ Reviewed-by: Ivan Vecera