Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2520350imm; Thu, 7 Jun 2018 12:02:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKaWjMViGdI5M3k6tYflfiCTlOaSoDAvKZdCXfTogc8MmJ6mnbYwpXrv6vP3G6+TtTKLQts X-Received: by 2002:a17:902:24a5:: with SMTP id w34-v6mr3240697pla.52.1528398177959; Thu, 07 Jun 2018 12:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528398177; cv=none; d=google.com; s=arc-20160816; b=ob5Wf9wgwAhXpyOoLEY1mPoGMASHmX8Szee8VpzRI/Iw4wNa2TkORhxG5UHtuRKpRJ f1KPnZv18j21O5KlYPpaZCheimBHBu5Os+Fh8SiQJOkedaZ1HGn2z9TUe72c1L3sFNS0 KrMgp5L/kGKUrwz+wGkGt2PPm1hdmWymdpzi/l4Abz1yrQRZrMEKgFxmbVtlKY8XnZBH MkCz3KwBHIZQNLPs4nTmAzVURsw4V1B8IfYLn6zILlysP2PJ5u+8lppufE8Xv9d2PvQm XEGanh7MAxUieMNovgcGCqp+NV2yg+iCjCHtFvCafZQos1EV3UNgxmTf/rNu6pAVbdc7 jjgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=ZQL2d7QX3J3/67l97uMd8PqKbNVhG+ABt0zLIX8nNXY=; b=QA38jFEAMOgYGwMVWqZcpFA0XCbnhMFZyNe45fLUN0acS8tO5twiD9MuzqP8YKpeaP 3o6mVbV4CJ4fSy3hH+fJecDNQTXS+lq4LDYJ177fo6T6XDwjmPyz8l9CSmKSkcbMmcuQ DUbS1Ow9I2CqelmFHLvUfIwOi4XLYgELP1duxHuunVYa7j6KteJ6/4hX0z3teDgW2ZD+ K3v0UBEYq606hDMuJY0slxrV9o+e6OecHiQv2PZPgGY9FZ1sn6ezQUcHGvNFFheH826/ WSgFL6n8BaFrqP9ziyqqR1FN/Q8JSR347H3A56/CSsnsjMA5SUmssnXkHCivcJbjoWtn EpPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=KQOQSo8e; 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 d6-v6si52557632plo.542.2018.06.07.12.02.42; Thu, 07 Jun 2018 12:02:57 -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=pass header.i=@lunn.ch header.s=20171124 header.b=KQOQSo8e; 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 S1753689AbeFGQwg (ORCPT + 99 others); Thu, 7 Jun 2018 12:52:36 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:56967 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750933AbeFGQwe (ORCPT ); Thu, 7 Jun 2018 12:52:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=ZQL2d7QX3J3/67l97uMd8PqKbNVhG+ABt0zLIX8nNXY=; b=KQOQSo8ecuf14597tLaJkoiW4bIFdML3ejKkpuAvbx1Re3d8UmcZzUiMYoGMnDxyvzCQBDFlIwKD+zdvpjpT9/kZCPYT67Got8F9/rDczZh0LcqOBAhKN05xV3QToiwf9oadQSv6SY/Y34WOmpHk1yh+aAr1eTRHu4adW23uUIc=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1fQy9D-0001e9-Q4; Thu, 07 Jun 2018 18:52:27 +0200 Date: Thu, 7 Jun 2018 18:52:27 +0200 From: Andrew Lunn To: Brandon Maier Cc: netdev@vger.kernel.org, f.fainelli@gmail.com, davem@davemloft.net, michal.simek@xilinx.com, clayton.shotwell@rockwellcollins.com, kristopher.cory@rockwellcollins.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] net: phy: Check phy_driver ready before accessing Message-ID: <20180607165227.GD25513@lunn.ch> References: <20180607155348.149665-1-brandon.maier@rockwellcollins.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180607155348.149665-1-brandon.maier@rockwellcollins.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 07, 2018 at 10:53:46AM -0500, Brandon Maier wrote: > Since a phy_device is added to the global mdio_bus list during > phy_device_register(), but a phy_device's phy_driver doesn't get > attached until phy_probe(). It's possible of_phy_find_device() in > xgmiitorgmii will return a valid phy with a NULL phy_driver. Leading to > a NULL pointer access during the memcpy(). I'm sure there are more issues like this in the code. e.g. there is no attempt made to hold a reference to the child phy. So it could be unbound. priv->phy_drv->read_status(phydev) is then going to do bad things. Reviewed-by: Andrew Lunn Andrew