From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 B7B19513555; Wed, 30 Sep 2026 16:45:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790786705; cv=none; b=MVnJedLYzEMY5FyG4ilMrkhkQynxq0cXlExVhb1B5B+KaBoxIeNOE1B2KtiSfPm3RKj53BD5jxj1a2WYOuJ7hoJMP6b3t8Vzp5pC6RTiER6cjhaHZy34Rqe02qd9qyxz6VnEQUPno6M20hvbXA7UfVb1cqmmLHLyUsDgIZpchuc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790786705; c=relaxed/simple; bh=dRSmskiLNa+U8d3OUg7yA3keomLpavDsZGqtU02IQtA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KVUfSdKdRL0TGq+DLFjPo4Bjysaf/DymSWokPWeu6UgaJQNoAZV6i46QwcLaJ/88T7vSfRp8uGFZUvdbQ3vMrext5xi1T3gbrbXucu1NB295xQnOaYULm4uwpRZvV9jMon0/BcA3eluvSQTK+PUUEAqD8QSVNhKimIrOtfWD8vI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mWIk3YfB; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="mWIk3YfB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CF671F000FF; Wed, 30 Sep 2026 16:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790786704; bh=AzLLY0QQd4WT7yQ9tgEHUncrx/kRscaK9tUs4IKrl1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mWIk3YfBI8FQEUMv7d8fmjMxxnvXesZNyQ0ZBC3BOnoRpm+le2iw8U/JI3BAvXlVr fIplLlMLyTKdTJEhj2IwkIdXL67T7L1f/xgV+2ir5W5JnIl/nfJr3inE0IsULSzTXt bFimQOiy2aqzz70nUiFW2PoGChsZ8tSTKmYU24YY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wentao Liang , Simon Horman , Paolo Abeni Subject: [PATCH 6.1 955/982] net: hisilicon: hns_dsaf_mac: fix mdio device leak in hns_mac_register_phy() Date: Wed, 30 Sep 2026 17:28:11 +0200 Message-ID: <20260930152437.247431826@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152416.775402466@linuxfoundation.org> References: <20260930152416.775402466@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wentao Liang commit 999e8295bc41d6ce45b8e54f88150efa96f3f01e upstream. hns_dsaf_find_platform_device() returns the mdio platform device with its reference count incremented. hns_mac_register_phy() never drops that reference, so the mdio device can not be released. Release the reference on both the deferred probe and the normal path. Fixes: 1d1afa2ebf82 ("net: hns: register phy device in each mac initial sequence") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang Reviewed-by: Simon Horman Link: https://patch.msgid.link/20260917110828.2148390-1-vulab@iscas.ac.cn Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c @@ -793,6 +793,7 @@ static int hns_mac_register_phy(struct h dev_err(mac_cb->dev, "mac%d mdio is NULL, dsaf will probe again later\n", mac_cb->mac_id); + put_device(&pdev->dev); return -EPROBE_DEFER; } @@ -801,6 +802,8 @@ static int hns_mac_register_phy(struct h dev_dbg(mac_cb->dev, "mac%d register phy addr:%d\n", mac_cb->mac_id, addr); + put_device(&pdev->dev); + return rc; }