From mboxrd@z Thu Jan 1 00:00:00 1970 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 EB5E73A0E8E for ; Tue, 19 May 2026 10:21:08 +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=1779186069; cv=none; b=BvQ6h3HZoxu+qHFxJ1X3XAumYgRsBAxpRuxCc3xwMAobp95PY0YYc8jgvB2j/2vdOyuxIwAxCP3ECKG6MsHQ/z4FJa9kClBzrI/Rj+4plDff7rY1iFxaubjPDhz0GjWXHouo3lp6Wipo0/q2dbFhHZmnWEBVZCp7n8RM/Mk+DsM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779186069; c=relaxed/simple; bh=aeQUTb8si66WScz2qnYSDC+yTkrTwDBvEV3vRJvDl/w=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=Ux+E8aCTBZR7b6USnOi4thIT+gHrd0/GIZCZfyoHSg6I2Jq4ULHD1+VN6TvyPdlWZqms117Gyec3EAFvK/0zsr6zAPCpCGQ0O80Q2qNURylBRB+ijSnccJaPqCb9dAAbp9ht0S3lnGxyNrdmvI9edpP2xg2gj3XTrTX98yt3szQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1+4tfQeP; 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="1+4tfQeP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FCCEC2BCB3; Tue, 19 May 2026 10:21:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1779186068; bh=aeQUTb8si66WScz2qnYSDC+yTkrTwDBvEV3vRJvDl/w=; h=Subject:To:Cc:From:Date:From; b=1+4tfQePJwZwodP9tW+PVBiI0ot1JedKCvukZjwFf55IxENfkIzEDdyiRDERmGWUx rJEk+G9Asogyyw4ks8EECjUNYtllmC9fnXV4ddcE2GzEIhPGWYC7kyqkOLQIIHvFfP e05eZU8OduLqyuyI2eAPPv86Wv61W0ozRwB+PiCE= Subject: FAILED: patch "[PATCH] net: ethtool: phy: avoid NULL deref when PHY driver is" failed to apply to 7.0-stable tree To: devnexen@gmail.com,kuba@kernel.org,maxime.chevallier@bootlin.com Cc: From: Date: Tue, 19 May 2026 12:20:22 +0200 Message-ID: <2026051922-likely-backless-a84b@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 7.0-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.0.y git checkout FETCH_HEAD git cherry-pick -x e3adf69f8eb121a9128c2b0029efd050d3649153 # git commit -s git send-email --to '' --in-reply-to '2026051922-likely-backless-a84b@gregkh' --subject-prefix 'PATCH 7.0.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From e3adf69f8eb121a9128c2b0029efd050d3649153 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 9 May 2026 22:50:46 +0100 Subject: [PATCH] net: ethtool: phy: avoid NULL deref when PHY driver is unbound phydev->drv can become NULL while the phy_device is still attached to its net_device, namely after the PHY driver is unbound via sysfs: echo > /sys/bus/mdio_bus/drivers//unbind phy_remove() clears phydev->drv but doesn't call phy_detach(), so the phy_device stays in the link topology xarray and ethnl_req_get_phydev() still hands it back. ETHTOOL_MSG_PHY_GET then oopses on: rep_data->drvname = kstrdup(phydev->drv->name, GFP_KERNEL); drvname is already treated as optional by phy_reply_size(), phy_fill_reply() and phy_cleanup_data(), so just skip the allocation when there is no driver bound. Fixes: 9dd2ad5e92b9 ("net: ethtool: phy: Convert the PHY_GET command to generic phy dump") Cc: stable@vger.kernel.org # 6.13.x Signed-off-by: David Carlier Reviewed-by: Maxime Chevallier Tested-by: Maxime Chevallier Link: https://patch.msgid.link/20260509215046.107157-1-devnexen@gmail.com Signed-off-by: Jakub Kicinski diff --git a/net/ethtool/phy.c b/net/ethtool/phy.c index f76d94d848d6..ddc6eab701ed 100644 --- a/net/ethtool/phy.c +++ b/net/ethtool/phy.c @@ -94,10 +94,12 @@ static int phy_prepare_data(const struct ethnl_req_info *req_info, if (!rep_data->name) return -ENOMEM; - rep_data->drvname = kstrdup(phydev->drv->name, GFP_KERNEL); - if (!rep_data->drvname) { - ret = -ENOMEM; - goto err_free_name; + if (phydev->drv) { + rep_data->drvname = kstrdup(phydev->drv->name, GFP_KERNEL); + if (!rep_data->drvname) { + ret = -ENOMEM; + goto err_free_name; + } } rep_data->upstream_type = pdn->upstream_type;