From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 8BDAA38170D for ; Thu, 29 Jan 2026 11:08:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769684889; cv=none; b=ZM+8HiD6Fotvp0Wt2/0AXv8Mnwdn1gMkcbcZKOPbAVvbnc0OWarrAxEK2tJF2rzBa1oApESJiA4Kvg485ZEe2/rFsdOmPrKddsw4Zu+GB2KXvCltyyCydLib2gehx8id7GIGlKPrJxpSlB+NjKP9D3g+eKiZ/zzfm9QBU6+eELc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769684889; c=relaxed/simple; bh=VO+8rp/bLfGqAH28Zcs4Kfuvsdslw/N3JtsbzEIUO/Y=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=QhkbMrZO1vEr49CptH7XNdnOIijhAD1pjBC8nj1a3uMTFLuL8dEpYwWtULTwNxqu/nPh18QT/p30aJDPXCO003gjsGh1uil7RNWtXITaJsJmM58FFthL4t6p6cXkMd6Fw9xIJ+11mMsMa2pm5BhFKX/R/A0qln3lOOfsIGuOmJA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=FEaEe1WM; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FEaEe1WM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769684887; 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=FEaEe1WMnwDI8iQRdcE+ei2Qjwz8hQNmachIkhmRjoFiRqAFQNrQlmLZztSxZ50YrI5OfD m3FIrmFVblgzVSlQICHtk80Ej4yDp+jQDgcMG/R9KQtpqNm7rm/t6OX2m72SmJqdikyIDs K4PH9LwTZ+q5juq1ajCYSFcLo1z6NT0= 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 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net] iavf: fix PTP use-after-free during reset To: Petr Oros , netdev@vger.kernel.org Cc: mschmidt@redhat.com, Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Jacob Keller , Simon Horman , Mateusz Polchlopek , intel-wired-lan@lists.osuosl.org, linux-kernel@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 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