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 B33DE2D23B2 for ; Thu, 3 Jul 2025 08:37:53 +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=1751531873; cv=none; b=NRUC2byaCwgIeWPq1VSElpD1k2hKczKFFYM5mPfQhexGKdpTDB4f3oSGSwabmA2D2XNtU0qOSghJCJkwyjuHEAaigcc0NUtIGU70Zjts6UD78ssiebkzT4dzjYdJM5/wEuxq+TXauEkfbVr8N1mXCXBaRp7P5s30Yh8e+uHrxX8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751531873; c=relaxed/simple; bh=TJ8Bh2/u1gj5ZqpOR1nZmVUxjhh4jUhBcg3lH9JaBpE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=BBrHDBXpOsaXxDl4EBjts+BpB39AYt/EVUU0e1YP8s6HJHMKcExDGrySU4qkGleYO/HyVDXCbnPI2oWQJBVkvsv4xioCx25myDSaVTYE9N9r7+fPN8utBeH8g0r3Ewleoo6iUA1GhO3aqMSFagGoq0fcVlugF2ftmduUIvWrtEI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=I0ZJYAC2; 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="I0ZJYAC2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 210EDC4CEE3; Thu, 3 Jul 2025 08:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751531873; bh=TJ8Bh2/u1gj5ZqpOR1nZmVUxjhh4jUhBcg3lH9JaBpE=; h=From:To:Cc:Subject:Date:Reply-to:From; b=I0ZJYAC2JZpI+WE0HS1VEZhxompv2pwacVCqDacr1IqgzciRuJ6wt1yR1ZMu/Wz0T 0Nrw/16/NqHzm+KPemqf8zUCizG7XL+bRdCS2xlwudRlV3Cv3cdfKsoTYghrggzmG+ SOv+M6tA8TpNlQxB/2avt7c2YoEl7PvXubq3Vwe8= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38149: net: phy: clear phydev->devlink when the link is deleted Date: Thu, 3 Jul 2025 10:36:06 +0200 Message-ID: <2025070336-CVE-2025-38149-0dad@gregkh> X-Mailer: git-send-email 2.50.0 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=3265; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=9Fv6y4LTgs6mlhNHYJYnnjPIGUIAV4MkUGJfYLEs8ok=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlpDjcM/s9xDRO9wtP2ob0hzqXk5llXwR0rWaVvGx2Me F1eZ5zSEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABOR8GCYzfr5YcxbNS7tlAut jOufnzu1f0VhFMOC1h8dx1peutU++574PqL0941830WyAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: net: phy: clear phydev->devlink when the link is deleted There is a potential crash issue when disabling and re-enabling the network port. When disabling the network port, phy_detach() calls device_link_del() to remove the device link, but it does not clear phydev->devlink, so phydev->devlink is not a NULL pointer. Then the network port is re-enabled, but if phy_attach_direct() fails before calling device_link_add(), the code jumps to the "error" label and calls phy_detach(). Since phydev->devlink retains the old value from the previous attach/detach cycle, device_link_del() uses the old value, which accesses a NULL pointer and causes a crash. The simplified crash log is as follows. [ 24.702421] Call trace: [ 24.704856] device_link_put_kref+0x20/0x120 [ 24.709124] device_link_del+0x30/0x48 [ 24.712864] phy_detach+0x24/0x168 [ 24.716261] phy_attach_direct+0x168/0x3a4 [ 24.720352] phylink_fwnode_phy_connect+0xc8/0x14c [ 24.725140] phylink_of_phy_connect+0x1c/0x34 Therefore, phydev->devlink needs to be cleared when the device link is deleted. The Linux kernel CVE team has assigned CVE-2025-38149 to this issue. Affected and fixed versions =========================== Issue introduced in 6.2 with commit bc66fa87d4fda9053a8145e5718fc278c2b88253 and fixed in 6.6.94 with commit 363fdf2777423ad346d781f09548cca14877f729 Issue introduced in 6.2 with commit bc66fa87d4fda9053a8145e5718fc278c2b88253 and fixed in 6.12.34 with commit ddc654e89ace723b78c34911c65243accbc9b75c Issue introduced in 6.2 with commit bc66fa87d4fda9053a8145e5718fc278c2b88253 and fixed in 6.15.3 with commit 034bc4a2a72dea2cfcaf24c6bae03c38ad5a0b87 Issue introduced in 6.2 with commit bc66fa87d4fda9053a8145e5718fc278c2b88253 and fixed in 6.16-rc1 with commit 0795b05a59b1371b18ffbf09d385296b12e9f5d5 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-38149 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: drivers/net/phy/phy_device.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/363fdf2777423ad346d781f09548cca14877f729 https://git.kernel.org/stable/c/ddc654e89ace723b78c34911c65243accbc9b75c https://git.kernel.org/stable/c/034bc4a2a72dea2cfcaf24c6bae03c38ad5a0b87 https://git.kernel.org/stable/c/0795b05a59b1371b18ffbf09d385296b12e9f5d5