From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796295360; b=ZrMABYSG9/iRzEOLz0yyffYDACdifGgsJE/muxNql/jHtGL6hhuFrOecorBTMOiAuWeZ NeV6YJUXMH0a4ynI6zC1FJwnn/Xd1KxezEsFbN0mmV0dLPr5c9xvfYbL5XjlGkWTsVJRO j/Yfb3MJ0s0oPhaAD2nkM2P19pwGl9tO1sGo7s7GEYpBVebPYp3tn3RXPoOZCNd/qzsOR S8R90iWzw0VHbFCczp4je61GwFC7VdVFb6N+/Sipfz5k8UNXsqhFGFmvwcWe0nQUNM09J LjEvDHdPEZ9Q9zL9LEHxxOMXl592sCdhvBeUu0zm/HygSlbXu+R8eIfo5BhSad/UR6g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796295360; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-Scanned-By; bh=Cs8rOSmcjuowtvgjvyxxmOPSQaQfzo4yYcjDC7xqAT0=; b=IWty81ksaP29JYmeKLD+yyvzQo9oUcZg+2KZrmqRw1Q09dsS+r+GbFo0e4QA2NMbk05g Dy0Q9x4mxDro8fSOIjZYMnQn6QS2BP9T4z191FD1B8TriuP0SlmKFWnaALngcAc9PuLec oz9Gl6Sw47jR1H5zSF1ihh8HN/2iWDDcEb1MVjAVl4B5MdvdSgSYBm+CKDHShUULzZI8D 4dh+YVod+NyxehtqTumTIFpBltvdvrhWhlnbt4CnlQrbcx+ex//aE+y7uDdb8XxDWQF/Y HpvOCiIcJEEbl2yB/t2n/+ZfpwYz4fYqjHgY3o2MCYbQYg1DLKRmons3WESuM3wnxPA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=TlLhZMm0; arc=none smtp.remote-ip=170.10.129.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5C4C606A32C for ; Thu, 3 Dec 2026 10:55:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D5C4C606A32C 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.a=rsa-sha256 header.s=mimecast20190719 header.b=TlLhZMm0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796295358; 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=Cs8rOSmcjuowtvgjvyxxmOPSQaQfzo4yYcjDC7xqAT0=; b=TlLhZMm08CMRRNgKgBs6mQvjfCGPzzL4YNWNwMJcI04IzPr1mXn53upuy19qEJQu132AdB 0ohZUzfL0q+EeWp2DrvDTd9SA8EE9tZlYYgeDcYBSUe/ptWD1rilKvQkF0h79vL78qsxGR L3k//rYYETfVfOmplASAkwwk3ee43bk= 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-681-cQJzns2TO4ihNEk5oyVLYw-1; Thu, 3 Dec 2026 10:55:52 +0000 X-MC-Unique: cQJzns2TO4ihNEk5oyVLYw-1 X-Mimecast-MFC-AGG-ID: cQJzns2TO4ihNEk5oyVLYw_1796295349 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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 65C6219774F4; Thu, 3 Dec 2026 10:55:49 +0000 (UTC) Received: from [100.91.101.41] (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C7D95B8D; Thu, 3 Dec 2026 10:55:41 +0000 (UTC) Message-ID: Date: Thu, 3 Dec 2026 11:55:40 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net v7 1/4] ice: stop the service task before the PF is unloaded To: Petr Oros , netdev@vger.kernel.org Cc: Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Aleksandr Loktionov , Simon Horman , Michal Swiatkowski , Grzegorz Nitka , Paul Menzel , Wojciech Drewek , Marcin Szycik , Martyna Szapar-Mudlaw , Alice Michael , Jacob Keller , Jesse Brandeburg , Patryk Holda , Rinitha S , Aaron Ma , intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org References: <20261202071642.2527605-1-poros@redhat.com> <20261202071642.2527605-2-poros@redhat.com> Content-Language: en-US From: Ivan Vecera In-Reply-To: <20261202071642.2527605-2-poros@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 On 12/2/26 08:16, Petr Oros wrote: > Commit 8a37f9e2ff40 ("ice: move ice_deinit_dev() to the end of deinit > paths") moved the service task stop and the cancel of the AdminQ event > waiters from after ice_free_vfs() to the end of ice_remove(). Since then > a queued or running service task can still walk pf->vsi[] while > ice_remove_arfs(), ice_unload() and ice_deinit() free the aRFS filters, > the netdev, the LAG and the VSIs. A last run that takes longer than a > timer period also arms the service timer again after the stop at the > end has deleted it, and the timer then fires after the PF is freed. > > Stop the service task and cancel the waiters after ice_free_vfs() again, > and make that stop final. The new ice_service_task_shutdown() also > disables the work and shuts the timer down, so a caller that passed the > ICE_SERVICE_DIS test before the stop can no longer queue the work, and > a run in progress can no longer arm the timer after its delete. The > recovery mode branch of ice_remove() gets the same final stop. The stop > in ice_deinit_dev() stays for its other callers. As > before that commit, a devlink flash that is still running when the > driver is removed fails, at the latest when its next AdminQ wait times > out. > > This only hardens the removal path. ice_devlink_reinit_down() and the > error paths of ice_probe() and ice_devlink_reinit_up() also tear the PF > down before they stop the service task, all three are older than that > commit and are not changed here. > > Found by AI code review. Validated on an E810-C (FW 8.1.1, ICE COMMS > package 1.3.55.0) with a test-only 12 s delay in ice_sync_fltr_subtask() > after it took the VSI pointer, armed right before a promisc change and > rmmod ice. Without this patch KASAN reports a slab-use-after-free in > ice_vsi_fltr_changed() on the freed main VSI, and the kernel then faults > in call_timer_fn() on the timer function of the unloaded module. With it > rmmod waits for the run and nothing is reported. Also tested by removing > the driver during switchdev sessions and with four VFs bound to iavf. No > kernel selftests cover this. > > Fixes: 8a37f9e2ff40 ("ice: move ice_deinit_dev() to the end of deinit paths") > Signed-off-by: Petr Oros Reviewed-by: Ivan Vecera