Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1003772ybb; Fri, 3 Apr 2020 16:12:36 -0700 (PDT) X-Google-Smtp-Source: APiQypIkcoEejI2YrkyLGEY4nxPtB8HwEZcEooWAvW0i6tLBDfZz4g4k9TWCPWpMbSEMMUKHdDob X-Received: by 2002:a05:6830:22c3:: with SMTP id q3mr8872488otc.152.1585955556096; Fri, 03 Apr 2020 16:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585955556; cv=none; d=google.com; s=arc-20160816; b=ClRspvCtpXiwlLRvYdXljZbh5+C9211kVncqsDWFfHLixA9YpV/PRSfENPM7K2pco+ xfrap3oD2n0LmLyOTbH9ionZy/3GqwbF1OayKPLxQgPSebkEJIeOvcH31kCieDm0d+Ju wfYqk2/Ui5k37qc9nTs1CM518kAl+QzxNWgoRIuVipTCpWoxioCA2Xlq78H8DsUuynxJ PnV4xDO+sbd22NTlyGp1QQ0YZrorpyp00AO7vdrauevMWZXtD7sM/zqnoEzbFJrpDg0a LsaTQeTdKlWnD5PrBkutBW/FEC75YCX3uy5CurCdK9Hp0toMk1WCEMeCYXn9hSe0GYzV BDrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=G8pEXnM3HJM+OjoHpXh52rePHTsnRvB/9GgDBVTU5Lw=; b=fdZD9G1jOGeqR+EaTD/Hl4Idsr85jN5l/KmQYZESIi+qVj71KJuxnirpcdZh9Fbmtj /Xd6Ybj1pi+P4kPuieAOTjxTMIcBLDxihAQ9TtDzwb1fFyn9cw5Ixfpg8BYCZowWqD0t +okTcu3V/wOJTewGMedvwHML/gFVlfPjsUH4JQR8HOjFCrtweCykZrd4191qccKxO3Nj Rn5WX4ohPZiXDYJqdJ7iRGkKNivzSvM31SSQ8OJNpGE1mgQ4KYNKpnqPUhhhQkNHDryB jt95a6YusmCFgBhCYhJD0y727Z2wET85bziyUowpSGv+V79zxGp9Qc1mUrpBMdDYZCQb 0PIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u136si3902383oif.197.2020.04.03.16.12.23; Fri, 03 Apr 2020 16:12:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728615AbgDCXLm (ORCPT + 99 others); Fri, 3 Apr 2020 19:11:42 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:36440 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727829AbgDCXLm (ORCPT ); Fri, 3 Apr 2020 19:11:42 -0400 Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id B9F4B121938E3; Fri, 3 Apr 2020 16:11:40 -0700 (PDT) Date: Fri, 03 Apr 2020 16:11:39 -0700 (PDT) Message-Id: <20200403.161139.2115986079787627095.davem@davemloft.net> To: gch981213@gmail.com Cc: netdev@vger.kernel.org, stable@vger.kernel.org, sean.wang@mediatek.com, andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, matthias.bgg@gmail.com, opensource@vdorst.com, rmk+kernel@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: dsa: mt7530: fix null pointer dereferencing in port5 setup From: David Miller In-Reply-To: <20200403112830.505720-1-gch981213@gmail.com> References: <20200403112830.505720-1-gch981213@gmail.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 03 Apr 2020 16:11:41 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chuanhong Guo Date: Fri, 3 Apr 2020 19:28:24 +0800 > The 2nd gmac of mediatek soc ethernet may not be connected to a PHY > and a phy-handle isn't always available. > Unfortunately, mt7530 dsa driver assumes that the 2nd gmac is always > connected to switch port 5 and setup mt7530 according to phy address > of 2nd gmac node, causing null pointer dereferencing when phy-handle > isn't defined in dts. > This commit fix this setup code by checking return value of > of_parse_phandle before using it. > > Fixes: 38f790a80560 ("net: dsa: mt7530: Add support for port 5") > Signed-off-by: Chuanhong Guo > Cc: stable@vger.kernel.org Please do not CC: stable for networking changes, as per: Documentation/networking/netdev-FAQ.rstq Applied and queued up for -stable, thank you.