Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1609654ybb; Sat, 4 Apr 2020 08:11:09 -0700 (PDT) X-Google-Smtp-Source: APiQypLWIEHImlAqp6a46Z+jDZukx2P3BdzSY9YQvo7l7jG7gimycKvTkVYvG6EZdxQrBUAZsHq+ X-Received: by 2002:aca:5f8a:: with SMTP id t132mr7006508oib.132.1586013069644; Sat, 04 Apr 2020 08:11:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586013069; cv=none; d=google.com; s=arc-20160816; b=i7g3R6WwCj/pCrrFwlM3HOgj6bwvZ7hqEQ/U3U79s/RMupl6EVQKBdCADx5pnZee0u K4FNwpP7feYepur0z87Uw/siR4eXAm7/lgPoEIuMv5f34pyqtiRwM5C5eoWQgUZWlAea nXzxptz1e+NM9mkkB9WsHlHqS2PsrVOAmQYHH1pkZfznE/ljIgpB9+cvnO8UU1sNhl1O tx9iNiWLpo71w6rwoTqx/oFtBNhWKf45fg0zCHMo9Uba3EphJVoBPSQeUq/iotAPGxa/ 65gWkcv7d/QjA44rz40YgpJRGZrpJO5M/e/vpXxDbnepPdlVKtvniddguhkQwbUf6xu8 KxbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vp27F8VCbpDyMug+E/DkoFiqJ0iXvSFB3dG9NhdVtJ4=; b=CNemsremqdW40vYogsC3XHQer0YXBXgdjjhTgEfyebiqtNXFJ1x04wwk+kevux/p6b 6jv0kIyrvWYsT7HJBdIQ700PdIK6lGP/1QfOrFDbMEz+MK6x5aNQDTZvkvF2Svq4FVGd nvuoQ9ENmNyKpkpZ8WCgPzNE6KL6n1r4NEJ8/ffoCRTQP6qOaznnwR8D/ZyUxUGpl0I3 ERilfMzVKnko0RPJZCC0DBeYVbTWo65Q31IUBE1wE3Iu3CuDkzYZBd2Wx6wMiJzEuHwl zIOaIKYTs+6RmOhca9F4UjEhbEdn5iyxioqA7z+mydSLOay3hhJKMrkp3or4GaNPwW22 ujSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=c4fufxCN; 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 r11si3511021otd.26.2020.04.04.08.10.54; Sat, 04 Apr 2020 08:11:09 -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; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=c4fufxCN; 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 S1726380AbgDDPIr (ORCPT + 99 others); Sat, 4 Apr 2020 11:08:47 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:48146 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgDDPIr (ORCPT ); Sat, 4 Apr 2020 11:08:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=vp27F8VCbpDyMug+E/DkoFiqJ0iXvSFB3dG9NhdVtJ4=; b=c4fufxCNaxCfxlabO36Hw9VuYU Iy7BaNe3r6MvvPPy9rhjqGjZJpP9y0GM9FWH6DappHyVFuggm31hWHqH+YqpzuLjkqxjiY+lCXKRh qEj3F2/EgI8g3uP6a3Lm8t5Z4mb59eooVu3rTup4yLq4VA8REUq6oXm6aucvLfNwtXf8=; Received: from andrew by vps0.lunn.ch with local (Exim 4.93) (envelope-from ) id 1jKkP4-000xRF-B9; Sat, 04 Apr 2020 17:08:10 +0200 Date: Sat, 4 Apr 2020 17:08:10 +0200 From: Andrew Lunn To: Chuanhong Guo Cc: =?iso-8859-1?Q?Ren=E9?= van Dorst , netdev@vger.kernel.org, stable@vger.kernel.org, Sean Wang , Vivien Didelot , Florian Fainelli , "David S. Miller" , Matthias Brugger , Russell King , "moderated list:ARM/Mediatek SoC support" , linux-mediatek@lists.infradead.org, open list Subject: Re: [PATCH] net: dsa: mt7530: fix null pointer dereferencing in port5 setup Message-ID: <20200404150810.GA161768@lunn.ch> References: <20200403112830.505720-1-gch981213@gmail.com> <20200403180911.Horde.9xqnJvjcRDe-ttshlJbG6WE@www.vdorst.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 04, 2020 at 11:19:10AM +0800, Chuanhong Guo wrote: > Hi! > > On Sat, Apr 4, 2020 at 2:09 AM Ren? van Dorst wrote: > > > > Quoting Chuanhong Guo : > > > > Hi Chuanhong, > > > > > 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. > > > > MT7530 tries to detect if 2nd GMAC is using a phy with phy-address 0 or 4. > > What if the 2nd GMAC connects to an external PHY on address 0 on a > different mdio-bus? In general, you using a phy-handle to cover such a situation. If there is a phy-handle, just use it. Andrew