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 X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A9EEC2BA1A for ; Sat, 4 Apr 2020 15:08:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 381AE206C3 for ; Sat, 4 Apr 2020 15:08:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="c4fufxCN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726417AbgDDPIr (ORCPT ); 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