From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796207796; b=MAaIWOpkGJA8h66OEg36765GpkN6S7peblnC15EMComz93rOpYtitBYLfrwhSu69p7Lb h9EaMSSf+PtfdgeZ/X+Uh1NMcE8Pa/05pfQyOy6I+jdvibw7+zAxRTGnwiosePLzp6scW mr2CyZAH01NubRoHDDLUW/jmG/c2uWGHr0i+ATrldjaocp/WmSja/f9du8I3fL3qHHH3B +2WlBfImrM3xlNAv+eGiA6KXKpf5nfLjhCtlIpURtDw8eYFzJ5rsm6i32yozPl/Oc7ct3 jFss52wkbtLwjA9CSl0H3CEfWEOjA2wriPwTcvSp0ER84qiGjX5gml94rloM/s2YcrQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796207796; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=nIvEVV7cmyxqTjc1uPyFgbCPyEK88ZF+nKHls+gcsL8=; b=DOwP6x9IjQQBws2a52M1FslQ5Vi8DXPcIvEGeAx1epZsRnwZlwHVYOBiWTOFsSiuIsZ+ k8xUcVzMgsXNham5zFVC/0yObpsIcKoLr9SpEBqVV+W/C3cXG7sg2zdYPt5gO+dFQ1imv aQE7bQBdzqUIY4owhlSPEDozrlhHR55n3ppBfFQ71RbJfb183HXoia175GrkzmwC08vmX nuJ+zdRK4ZowJrmC1KDL3m7o630fbJWi2vY5T/2/sXdsWbpNI0A7Jqx+kP0WlItlTFbGI g+7xhOZu7KykLMp1zFktnZvNHlnA40Ea2ykN500z5mVG8+FIjfdySpWgt3La35qVPEA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=F4Tdj0BY; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76FC8606A68D for ; Wed, 2 Dec 2026 10:36:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=F4Tdj0BY Received: by smtp.kernel.org (Postfix) with ESMTPSA id 876BE1F00893; Wed, 2 Dec 2026 10:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796207795; bh=nIvEVV7cmyxqTjc1uPyFgbCPyEK88ZF+nKHls+gcsL8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=F4Tdj0BYlWrG6OackTlaecgsqvkYAkk/TbHFw7PL0PuSEq4joRZPXDflX0+I0+3Gd mMQgq1J3dW2Nii6yjoGaGQGxI2g8dStR96SxcAgDhVH10GnK+QyVghOK9/fY8utCyb EH/qymc+6GZi43hJmiiXJcOJfyzRrLiRfsrDVCmjPrmDWHDQlvSvb+/eeMbFcXTJk6 2AdH3o6sN2s6s/Pve/+/DJf4SF3kMFfilkovNXCklvWdSLHrniQZxUIxSkpNCONnTO tobLEqlaQvA/7w4fnOY40BvuNaeS8uJleUOZ5qtXFU7wFPyx1xUnxsXYUTHd5Qe97C BsqOa7U/555tA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net v2] net: update RX queue kobjects during device unregistration Reply-To: sashiko-reviews@lists.linux.dev To: "Haishuang Yan" Cc: virtualization@lists.linux.dev, "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <20261202102744.31020-1-yanhaishuang@cmss.chinamobile.com> References: <20261202102744.31020-1-yanhaishuang@cmss.chinamobile.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 10:36:35 +0000 X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > When unregister_netdevice_many_notify() sets NETREG_UNREGISTERING and > calls dev_xdp_uninstall(), a driver that shrinks real_num_rx_queues > (such as virtio_net) hits netif_set_real_num_rx_queues(). Because it > only checks NETREG_REGISTERED, it skips net_rx_queue_update_kobjects() > while still lowering dev->real_num_rx_queues. remove_queue_kobjects() > then leaks the extra RX queue kobjects and their netdev references, > hanging unregister with "waiting for eth0 to become free. Usage count > =3D 2". >=20 > Update RX queue kobjects under NETREG_UNREGISTERING too, matching > netif_set_real_num_tx_queues() from > commit 5c56580b74e5 ("net: Adjust TX queue kobjects if number of queues > changes during unregister"). >=20 > Like netdev_queue_update_kobjects(), warn in > net_rx_queue_update_kobjects() if new_num > old_num during > NETREG_UNREGISTERING. Also return -EINVAL there: once > remove_queue_kobjects() has released dev->queues_kset and set > real_num_rx_queues to 0, any later call would add kobjects to the > released kset and take netdev references that are never dropped. > No in-tree caller is known to grow RX queues during unregister. >=20 > Found and verified by unbinding virtio_net with XDP attached in an > x86_64 KVM guest (KASAN + NET_DEV_REFCNT_TRACKER). >=20 > Fixes: bd0b2e7fe611 ("net: xdp: make the stack take care of the tear down= ") > Signed-off-by: Haishuang Yan Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202102744.3102= 0-1-yanhaishuang@cmss.chinamobile.com?part=3D1