Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1884C1FFC59 for ; Thu, 13 Feb 2025 15:39:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739461187; cv=none; b=rvQCKcxwYVON49396N5jPHOwdJ140a0fgdQqv+ObDNcBUh0Z1Jt5UAbHcTgFpV2o09npyIgnlS57sdrKJ6S9Ggx8jZ8Tau808Qr+rlqZ2AF+ocZF8ayV4v0YdRN0OM72VMH1eAjpIe9OYkFgniYOvbT/aQXXuNBwrAi3Kgw87Vc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739461187; c=relaxed/simple; bh=naFcbv+2nBp32LJtmaLiezcx7I6RfadKqmpJv43j3Vw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QP8c53OGprTM1pvpoReezPTTx6cLH6S7apprylXv8EUnBjTIcrFMJ5Fl89THbG+SU/OWWIyf2+q+LS1DxbuvRJbeFFZ2lSSEEBQpRRm6LTA9G/2bDczbX/X4t6kpChedujcW77AJNjSnrkwHiM+G62lf7bMAMmkr/WPPhblvz14= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=m+Sy1T19; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="m+Sy1T19" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94851C4CEE9; Thu, 13 Feb 2025 15:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1739461187; bh=naFcbv+2nBp32LJtmaLiezcx7I6RfadKqmpJv43j3Vw=; h=From:To:Cc:Subject:Date:Reply-to:From; b=m+Sy1T19IUB5llSurX19yYZKLsruXceR/59ws4CeeOM5Wnab9YMGvsYjyk+2Hgkf+ +k4N8j/G1iDeRZszq1roRudCbnVy16nsuzYCQiPv2fslpBZCg2/e6h1cA1FYYUvfNT gXu6ISu1+TaBgVJTtbrfBW058pvo96wIxVCOWe5Y= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-21701: net: avoid race between device unregistration and ethnl ops Date: Thu, 13 Feb 2025 16:05:51 +0100 Message-ID: <2025021350-CVE-2025-21701-ce96@gregkh> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3946; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=naFcbv+2nBp32LJtmaLiezcx7I6RfadKqmpJv43j3Vw=; b=owGbwMvMwCRo6H6F97bub03G02pJDOnruPxKFbu7FHQr/hzylbjhM2Etk8eMwIf9Sf9778lNc WzYavyyI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACZydAfDPEW/5zrfzXYzz5B6 NMMoKZ/jjszxxQzzPXiMUmwLdN8+ZRfnmVpw9FXHutmOAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: net: avoid race between device unregistration and ethnl ops The following trace can be seen if a device is being unregistered while its number of channels are being modified. DEBUG_LOCKS_WARN_ON(lock->magic != lock) WARNING: CPU: 3 PID: 3754 at kernel/locking/mutex.c:564 __mutex_lock+0xc8a/0x1120 CPU: 3 UID: 0 PID: 3754 Comm: ethtool Not tainted 6.13.0-rc6+ #771 RIP: 0010:__mutex_lock+0xc8a/0x1120 Call Trace: ethtool_check_max_channel+0x1ea/0x880 ethnl_set_channels+0x3c3/0xb10 ethnl_default_set_doit+0x306/0x650 genl_family_rcv_msg_doit+0x1e3/0x2c0 genl_rcv_msg+0x432/0x6f0 netlink_rcv_skb+0x13d/0x3b0 genl_rcv+0x28/0x40 netlink_unicast+0x42e/0x720 netlink_sendmsg+0x765/0xc20 __sys_sendto+0x3ac/0x420 __x64_sys_sendto+0xe0/0x1c0 do_syscall_64+0x95/0x180 entry_SYSCALL_64_after_hwframe+0x76/0x7e This is because unregister_netdevice_many_notify might run before the rtnl lock section of ethnl operations, eg. set_channels in the above example. In this example the rss lock would be destroyed by the device unregistration path before being used again, but in general running ethnl operations while dismantle has started is not a good idea. Fix this by denying any operation on devices being unregistered. A check was already there in ethnl_ops_begin, but not wide enough. Note that the same issue cannot be seen on the ioctl version (__dev_ethtool) because the device reference is retrieved from within the rtnl lock section there. Once dismantle started, the net device is unlisted and no reference will be found. The Linux kernel CVE team has assigned CVE-2025-21701 to this issue. Affected and fixed versions =========================== Issue introduced in 5.16 with commit dde91ccfa25fd58f64c397d91b81a4b393100ffa and fixed in 6.6.76 with commit 2f29127e94ae9fdc7497331003d6860e9551cdf3 Issue introduced in 5.16 with commit dde91ccfa25fd58f64c397d91b81a4b393100ffa and fixed in 6.12.13 with commit b382ab9b885cbb665e0e70a727f101c981b4edf3 Issue introduced in 5.16 with commit dde91ccfa25fd58f64c397d91b81a4b393100ffa and fixed in 6.13.2 with commit 4dc880245f9b529fa8f476b5553c799d2848b47b Issue introduced in 5.16 with commit dde91ccfa25fd58f64c397d91b81a4b393100ffa and fixed in 6.14-rc1 with commit 12e070eb6964b341b41677fd260af5a305316a1f Issue introduced in 5.10.87 with commit 7c26da3be1e9843a15b5318f90db8a564479d2ac Issue introduced in 5.15.8 with commit cfd719f04267108f5f5bf802b9d7de69e99a99f9 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2025-21701 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: net/ethtool/netlink.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/2f29127e94ae9fdc7497331003d6860e9551cdf3 https://git.kernel.org/stable/c/b382ab9b885cbb665e0e70a727f101c981b4edf3 https://git.kernel.org/stable/c/4dc880245f9b529fa8f476b5553c799d2848b47b https://git.kernel.org/stable/c/12e070eb6964b341b41677fd260af5a305316a1f