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 9AF0E20B804 for ; Tue, 1 Apr 2025 15:41:34 +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=1743522094; cv=none; b=ly50BgaO2bzo7uAKn1cFvI4Ufs3XQHwLvu8+BuHX6NGswLuifnY4a9ir9l1ErioS86b33K2+8g2iCRlgQJbAB/Nu8GUxWQzgg5tZpYbWvoVbwVz5zzsiEv3TGS+Ddm/Zt+vEqUEdvlm2uCqq49MIUBUHA0Pd7MV49LZW/e7lhIs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743522094; c=relaxed/simple; bh=r3mTekWFg0npLP3MZsDkiTQbAL8GEmOTAS2t3yc0ux8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=M6gGlz0znqYH23A8OPC/j4voUiYl2PnGqCUST5rfSD6hbu2tvoCycA2daIZGUmT1gkFK2/Bkzto3ixGs8vOzHr0/ZmMlL+tWG0c8erHaBEDerg8bjBxqNxC7Up+nzr6vkDzwMuKVScBB5o20Mtmn+G16uH5sRhKNUUK2vTyKGRY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hztuPB8T; 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="hztuPB8T" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30FEEC4CEE4; Tue, 1 Apr 2025 15:41:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1743522094; bh=r3mTekWFg0npLP3MZsDkiTQbAL8GEmOTAS2t3yc0ux8=; h=From:To:Cc:Subject:Date:Reply-to:From; b=hztuPB8TgfdBz3gTkaR/CZ+yRnzLViqKKhUaj/0DVMihXuUszg1rMfWxEtIVuBMvk A9BNWjGcstH+ZUJpAJJq2Nv4jTdGzpi+02bBNALleMv0jWjXY1jmN/zcaYkcPMIBkq PuQvNNIgppdfs6ru4CqQ1SHFBFeSzvvDjoHkuo3w= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-21921: net: ethtool: netlink: Allow NULL nlattrs when getting a phy_device Date: Tue, 1 Apr 2025 16:39:45 +0100 Message-ID: <2025040131-CVE-2025-21921-9deb@gregkh> X-Mailer: git-send-email 2.49.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=3236; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=r3mTekWFg0npLP3MZsDkiTQbAL8GEmOTAS2t3yc0ux8=; b=owGbwMvMwCRo6H6F97bub03G02pJDOlvOLa4npm8+XnHn+kL55apvd7Cbr2tQNebpcWMNTxoQ mAd+3nzjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZiIsQDDgs6ZSobHPppwTjfp dJ97VvzjgzcL9jEs2Ck3cdkN36mTl4l8+MUTzmXjnJa9EgA= 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: ethtool: netlink: Allow NULL nlattrs when getting a phy_device ethnl_req_get_phydev() is used to lookup a phy_device, in the case an ethtool netlink command targets a specific phydev within a netdev's topology. It takes as a parameter a const struct nlattr *header that's used for error handling : if (!phydev) { NL_SET_ERR_MSG_ATTR(extack, header, "no phy matching phyindex"); return ERR_PTR(-ENODEV); } In the notify path after a ->set operation however, there's no request attributes available. The typical callsite for the above function looks like: phydev = ethnl_req_get_phydev(req_base, tb[ETHTOOL_A_XXX_HEADER], info->extack); So, when tb is NULL (such as in the ethnl notify path), we have a nice crash. It turns out that there's only the PLCA command that is in that case, as the other phydev-specific commands don't have a notification. This commit fixes the crash by passing the cmd index and the nlattr array separately, allowing NULL-checking it directly inside the helper. The Linux kernel CVE team has assigned CVE-2025-21921 to this issue. Affected and fixed versions =========================== Issue introduced in 6.12 with commit c15e065b46dc4e19837275b826c1960d55564abd and fixed in 6.12.19 with commit 639c70352958735addbba5ae7dd65985da96e061 Issue introduced in 6.12 with commit c15e065b46dc4e19837275b826c1960d55564abd and fixed in 6.13.7 with commit 1f458fa42c29144cef280e05bc49fc21b873d897 Issue introduced in 6.12 with commit c15e065b46dc4e19837275b826c1960d55564abd and fixed in 6.14 with commit 637399bf7e77797811adf340090b561a8f9d1213 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-21921 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/cabletest.c net/ethtool/linkstate.c net/ethtool/netlink.c net/ethtool/netlink.h net/ethtool/phy.c net/ethtool/plca.c net/ethtool/pse-pd.c net/ethtool/stats.c net/ethtool/strset.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/639c70352958735addbba5ae7dd65985da96e061 https://git.kernel.org/stable/c/1f458fa42c29144cef280e05bc49fc21b873d897 https://git.kernel.org/stable/c/637399bf7e77797811adf340090b561a8f9d1213