From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796295403; b=IaJHKLxFog2tiRGyNlTHO7PA0fwR0BlmFnIinKfhA8JT/yctVLejh8LcWHFIoTWbMIn8 6N/wFPeb7gwrmJTBvuq509WGH/xTojQXA5jadSJSwtusdmwoYAplfdz5ZfSqpe+4GJnMW UzuV8VGj/mmPK8NRbaWTyOlJUmCUyBxpT/pWjb++RN9xHzAB/AkzmCCOwMwhtxTvYM+2+ sdYMN/GooF56jKdpdukLZXc851lKp2JGHMIYMg6HfSMTmGgvX7Ghwb6gcfHyYkbKEgn1I 0FSbHn+dimuhikza5+Pq9fC4PHAJXS7gti6ZMPDKTUE1DJEd6wmLpVGJdx2w80NT2yA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796295403; 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=etuKqm1K0PZL64HJiV9LqvBEc/sWtysigT5C86cT7nY=; b=yUlg/kc47pFSGYhMsq0k/D2/2yASUfvOpqLeQyE3Ws68kyV1ChVseQHdZNAUU+IJriGb hd6fPC9XLIE5TEQGr80R2Ohl+VFkeOM0XWfs/pEMg4/bzANV9sHKqKHjUwCvXwSVQZmzS P+yYfmTDnUysncRU1wGE3YPaDh/4VYPdk0ysMgmiONmEsJ3mXxnO9MNaXV/qz9GNzjxNK d3CZBTbt4AB3KT6nUcaDOGlqv4ZpBQwYihoNz09AR4vfdPrE7eU+aSl9Mzhp/D9qSygpC UKvMn5yf664XFZFnuJQz2i3gjieAEnleBjFoK+uB15KyMyLHVJ09Cs8Wo2ZiQhil+hQ== 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=Z26lkQ1S; arc=none smtp.remote-ip=170.10.133.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 62010606A322 for ; Thu, 3 Dec 2026 10:56:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 62010606A322 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=Z26lkQ1S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796295401; 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=etuKqm1K0PZL64HJiV9LqvBEc/sWtysigT5C86cT7nY=; b=Z26lkQ1Su9l7vAgPaGIOdEdQ8vspwEkVj0nrlfVZb4Yo+FtBlteSMllJFWHFFoSxYjscDE Cklqf6tLQJ+ags67uImTShfIS7gWaRochds1n68qI0Nqrk78OdG1EqB3R5FddFm6RVfSJg f4SP9FfdgU44iit5JMLb0obywTu1E6g= Received: from mx-prod-mc-01.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-544-ZH14CmdVP9aCrJh2EOw7kQ-1; Thu, 3 Dec 2026 10:56:36 +0000 X-MC-Unique: ZH14CmdVP9aCrJh2EOw7kQ-1 X-Mimecast-MFC-AGG-ID: ZH14CmdVP9aCrJh2EOw7kQ_1796295394 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 213451978C9A; Thu, 3 Dec 2026 10:56:33 +0000 (UTC) Received: from [100.91.101.41] (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9187230001B9; Thu, 3 Dec 2026 10:56:26 +0000 (UTC) Message-ID: <0394c202-828a-42ad-8c11-774eaf912c65@redhat.com> Date: Thu, 3 Dec 2026 11:56:25 +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 2/4] ice: do not leave switchdev mode while subfunction ports exist 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-3-poros@redhat.com> Content-Language: en-US From: Ivan Vecera In-Reply-To: <20261202071642.2527605-3-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 12/2/26 08:16, Petr Oros wrote: > ice_eswitch_mode_set() refuses a mode change only while VFs exist, but a > subfunction port has a representor and a switchdev session too. devlink > core usually refuses the change first, because of the devlink rate nodes > the representors export, but ice exports none while DCB is active. A > switch to legacy then destroys the representor xarray under the running > session and the uplink stays in its switchdev configuration. Deleting > the SF port afterwards frees its devlink port while it stays > registered, so a later devlink port dump reads freed memory. > > Refuse the switch to legacy while subfunction ports exist. Check > pf->dyn_ports, which only changes under the devlink instance lock held > here, while ice_sf_dev_probe() can change the representor xarray > without it. > > Found by AI code review. Reproduced on an E810-C (FW 8.1.1, ICE COMMS > package 1.3.55.0) with the firmware LLDP agent off, without kernel > changes: > > dcb ets set dev $PF tc-tsa all:ets tc-bw 0:50 1:50 prio-tc 1:1 > devlink dev eswitch set pci/$BDF mode switchdev > devlink port add pci/$BDF flavour pcisf pfnum 0 sfnum 88 > devlink dev eswitch set pci/$BDF mode legacy > > The last command succeeded, the representor netdev stayed registered > and promisc off no longer took effect on the PF. Deleting the SF > port then returned 0 and the next devlink port list read its freed > devlink port, KASAN reported a slab use after free in > devlink_nl_port_fill(). With this patch the mode switch fails with > "Remove all subfunction ports before changing eswitch mode", after > the SF port is deleted it succeeds, and promisc off takes effect > again. No kernel selftests cover this. > > Fixes: 977514fb0fa8 ("ice: create port representor for SF") > Signed-off-by: Petr Oros Reviewed-by: Ivan Vecera