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 B59A05208B0; Wed, 30 Sep 2026 17:32: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=1790789525; cv=none; b=M8sH22InWPbOurC/ZqJAtmcorv8auQEj7QFy1Y7wMBgmRTeZD9lM2Z3sJIxrbpRbCY4capMWLSQOQAJtUALpgtYFW9kRX8oYWrDHe7YuCceTfBUcJ/SYEIPdmtXK1XJ3n/ZOnytic8vrjsmRMFkfqPHCQkmTcunKO5OikQS/9y0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790789525; c=relaxed/simple; bh=pVag87shgoAQEMCk0SVkHV0R7ZLhDXpSDN2hq0j2KB0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PR93tEIoPBYPerjWKSt69vPIK6W9hzKE3upLl54XPkPJDPTJPjm45sKCqlr1Mg64XEcyRY+I8Sl7q4fC0SOVA5/y3KwPxQw/N7PufPhGn3sRc8O5ekGNEfuIgYBUDtCSSX4Wuj9K2ioSo9gpreYm0n7gscZ0d5MoiORxvvSl9vw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=J/JSNh2z; 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="J/JSNh2z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EE921F000FF; Wed, 30 Sep 2026 17:32:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790789524; bh=d1ThOb9yaMRtqNieM8LN76d46pEadkyvfFd2bxPtQoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=J/JSNh2zs7EIdPgLccspkM8soYXdIDCRAqihbTRGYSoe/B39sHy9Xm8KP4vYKorvV LsuAcikLUB2WASEkRAk2+rOsnv3YubSyTF2TOOkcgQqPsjo1JzkZouK6tTaQAT5ThJ LA5k3mnvCheW+dZk77MJcO8uHMtlLQMRxyqDiw4I= 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.12 509/877] net: hisilicon: hns_dsaf_mac: fix mdio device leak in hns_mac_register_phy() Date: Wed, 30 Sep 2026 17:23:40 +0200 Message-ID: <20260930152425.642861737@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152414.738996857@linuxfoundation.org> References: <20260930152414.738996857@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.12-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; }