From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E003CA1012 for ; Thu, 4 Sep 2025 10:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=huArWARCokThZpjRF1Cu2fcasnuZUlouYnFA+tGXGPA=; b=kIteEwqUY6jZnO fHdE4+werfre9m9G8ISrVTuKkgi6kEzf8W85RE1c1M9TePkGHg6zkehsn9ra8CQ1TGB3Ot7l7oQhi 96keuHP2/45XYhVXqNw7S83cQs6RMh3HRVH0//WT1ccEoNt10r3jy6LnQZrZ7nPoq3B4VXVNtooee bTC2kHxMhxh1KDJKHQlETVYtUSpjwSwnKfkK2vFpiEPv7/6SjIRWUAXYUiPz4D5Srt+lIZxIGusFL qKuFDkX3Suf8JTJbQgAFPvW7ZGgm1TqDC7b4Q1C5FYwPxiUo3Bya493jh5TcjFKblTK7XeC4trrqe mwWobKuhFucdYMIZ3BBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uu7dy-0000000B2yi-2bYk; Thu, 04 Sep 2025 10:56:42 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uu6gJ-0000000AhSh-1c8c; Thu, 04 Sep 2025 09:55:03 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id A53A660202; Thu, 4 Sep 2025 09:55:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3B5FC4CEF1; Thu, 4 Sep 2025 09:54:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756979702; bh=PkwoREsB9/pKPRtysjzXpw88sUFZQqfBBJxGudm+f48=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TD0N2AfykrOHqznsu9h1ZxeWsqAwTt0PUB0Iftz9PpWRbfPjknJt4qVMDq3BLA81i eI6ZQHOafWau1RyiBiHCISdcsQ8n2ALkLIW9Xbq5b+gQu66zDctJG17dCXnH9QxPMU B2Ay/I4KM9GO+/+4LVDKXTDq2iGmDidL3t6eHAZHpvpOcpyimiT0DmK2wIYU0OoTSo 33enSCOo3P57BkyNnRf16VpjQHzu9zrL0IH4g+B520euaqSqIFnSDVi93kNZ4MFvVo XxOE+R6Fn74sYv34SsqQxiE96EdBQOeUXUsMGDuKIl8stF4HG0e45zYe2r91WJqNoJ 0f+lTV2ZzxXog== Date: Thu, 4 Sep 2025 10:54:57 +0100 From: Simon Horman To: Yao Zi Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Russell King (Oracle)" , Jonas Karlman , David Wu , Chaoyi Chen , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org Subject: Re: [PATCH net] net: stmmac: dwmac-rk: Ensure clk_phy doesn't contain invalid address Message-ID: <20250904095457.GE372207@horms.kernel.org> References: <20250904031222.40953-3-ziyao@disroot.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20250904031222.40953-3-ziyao@disroot.org> X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org On Thu, Sep 04, 2025 at 03:12:24AM +0000, Yao Zi wrote: > We must set the clk_phy pointer to NULL to indicating it isn't available > if the optional phy clock couldn't be obtained. Otherwise the error code > returned by of_clk_get() could be wrongly taken as an address, causing > invalid pointer dereference when later clk_phy is passed to > clk_prepare_enable(). > > Fixes: da114122b831 ("net: ethernet: stmmac: dwmac-rk: Make the clk_phy could be used for external phy") > Signed-off-by: Yao Zi ... Hi, I this patch doesn't seem to match upstream code. Looking over the upstream code, it seems to me that going into the code in question .clk_phy should be NULL, as bsp_priv it is allocated using devm_kzalloc() over in rk_gmac_setup() While the upstream version of the code your patch modifies is as follows. And doesn't touch .clk_phy if integrated_phy is not set. if (plat->phy_node && bsp_priv->integrated_phy) { bsp_priv->clk_phy = of_clk_get(plat->phy_node, 0); ret = PTR_ERR_OR_ZERO(bsp_priv->clk_phy); if (ret) return dev_err_probe(dev, ret, "Cannot get PHY clock\n"); clk_set_rate(bsp_priv->clk_phy, 50000000); } Am I missing something? _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip