Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp585971pxb; Thu, 5 Nov 2020 07:52:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHav15c3WWYcN1O1gJRGzZlfKmhM54Q7y9DCx76ccSJOLe+ahrf62/PKMtTh7ptetSHPun X-Received: by 2002:a17:906:c298:: with SMTP id r24mr2945157ejz.76.1604591533989; Thu, 05 Nov 2020 07:52:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604591533; cv=none; d=google.com; s=arc-20160816; b=j9LN18mmP666ysTeqC+OymCCtshUtsnM9sWteUzducCcejyQGrN6UsxH1gpTgoVfQK w+Qv48hfjFht5LMEiutftjA3DNBD7n5W1yMP5VWn0tsYtjMyBBAo4/26uqEt9tJwFPpN boR0UuG6q2m/b/4fzxFEY07D/X8pOF70LSgMs7ERrtKclFVC7WYsYKraiJZqxbHImRBs jEK4vcXYScNEJxKh7/bRYqrftNIFNNlTh34e8XecX4gxCb1UgEGWEx96dPix4IshVldm UBWrMZ/8r9uJSWWtJn0XHgXO38fJYZn53TCPR7VphPNyJKkpsbWPlBL09owseFrj5c45 W2mg== 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; bh=qEnlfxKf6HytKLFOxZiI2nMmQQBkZmroWP4YwPxehjk=; b=kpXgbwcbMDJbg6gfDPkADVN1RMRCatDgSt8lfuqSV/jMGNVCIvfBS7PyqCmnTUksla cjfKIw4TpnH089b1y7Wk2xuTw7Ve74oHUkmooWMgLeW9g2TOQHTtql/dl6Bp9UdapQ5y w4qH233bQDIYAxAWO8XiQysou0E9mdoW7WI84AbvagHUxdBt8P0TNb0M7eLMoeXVsfXO pLvsB0yoKVT0eQKelO8OutQboUdgqZ0GPBMeRUIDwS9ZrtVUZJVReYZ1miGgIAYZsFnP VCoWCxareJKkDFbFn/0sz1wKuNcrWZt5Clgm3PC4OswtMkqJnHbSObaCFw7FYVgy4HI4 BYaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=xYu0g69d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b12si1402157ejz.656.2020.11.05.07.51.49; Thu, 05 Nov 2020 07:52:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=xYu0g69d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731339AbgKEPtm (ORCPT + 99 others); Thu, 5 Nov 2020 10:49:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731133AbgKEPtj (ORCPT ); Thu, 5 Nov 2020 10:49:39 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65091C0613CF; Thu, 5 Nov 2020 07:49:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding: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=qEnlfxKf6HytKLFOxZiI2nMmQQBkZmroWP4YwPxehjk=; b=xYu0g69dh2tsGaTk698clYo9m gTIox8LMPPwctLdOcYsU+5EN4EKs8SOTgPCd50X4Go8Ks75q5VYWiVMcvMT3Ka5kvc35AjlkSVkTt v5+b66GmOEtFtuIYDm8l6GZdo1Fc3Ym+vYqD9Yt7NKvn7Q7gMG1lw6amdyH1zt6bV4KNjY+w6X5e4 A1f6CNuEfDI7CX8DmYhz44crEgpGYx1ev0QlJcL8/7yvIJ1aMVnclm/617eDOjqLMAIGsNojbjYUZ 0yVw73EOAnG3F5Fbh/LiG5/1y+rPVfDT2HZ7m4g1IcCwgyCfTFv+CwkL72eX0Ca3ig6mw9xsvnFnV deYSjti2w==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:55416) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kahVV-0004k5-Ou; Thu, 05 Nov 2020 15:49:01 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1kahVQ-0004uV-V4; Thu, 05 Nov 2020 15:48:56 +0000 Date: Thu, 5 Nov 2020 15:48:56 +0000 From: Russell King - ARM Linux admin To: Nicolas Ferre Cc: Parshuram Thombare , kuba@kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, Claudiu.Beznea@microchip.com, Santiago.Esteban@microchip.com, andrew@lunn.ch, davem@davemloft.net, linux-kernel@vger.kernel.org, harini.katakam@xilinx.com, michal.simek@xilinx.com Subject: Re: [PATCH] net: macb: fix NULL dereference due to no pcs_config method Message-ID: <20201105154856.GN1551@shell.armlinux.org.uk> References: <1604587039-5646-1-git-send-email-pthombar@cadence.com> <6873cf12-456b-c121-037b-d2c5a6138cb3@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6873cf12-456b-c121-037b-d2c5a6138cb3@microchip.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King - ARM Linux admin Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 05, 2020 at 04:22:18PM +0100, Nicolas Ferre wrote: > On 05/11/2020 at 15:37, Parshuram Thombare wrote: > > This patch fixes NULL pointer dereference due to NULL pcs_config > > in pcs_ops. > > > > Fixes: e4e143e26ce8 ("net: macb: add support for high speed interface") > > What is this tag? In linux-next? As patch is not yet in Linus' tree, you > cannot refer to it like this. > > > Reported-by: Nicolas Ferre > > Link: https://lkml.org/lkml/2020/11/4/482 > > You might need to change this to a "lore" link: > https://lore.kernel.org/netdev/2db854c7-9ffb-328a-f346-f68982723d29@microchip.com/ > > > Signed-off-by: Parshuram Thombare > > This fix looks a bit weird to me. What about proposing a patch to Russell > like the chunk that you already identified in function > phylink_major_config()? No thanks. macb is currently the only case where a stub implementation for pcs_config() is required, which only occurs because the only appropriate protocol supported there is SGMII and not 1000base-X as well. > > --- > > drivers/net/ethernet/cadence/macb_main.c | 17 +++++++++++++++-- > > 1 file changed, 15 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c > > index b7bc160..130a5af 100644 > > --- a/drivers/net/ethernet/cadence/macb_main.c > > +++ b/drivers/net/ethernet/cadence/macb_main.c > > @@ -633,6 +633,15 @@ static void macb_pcs_an_restart(struct phylink_pcs *pcs) > > /* Not supported */ > > } > > > > +static int macb_pcs_config(struct phylink_pcs *pcs, > > + unsigned int mode, > > + phy_interface_t interface, > > + const unsigned long *advertising, > > + bool permit_pause_to_mac) > > +{ > > + return 0; > > +} > > Russell, is the requirement for this void function intended? In response to v3 of the patch on 21st October, I said, and I quote: I think all that needs to happen is a pcs_ops for the non-10GBASE-R mode which moves macb_mac_pcs_get_state() and macb_mac_an_restart() to it, and implements a stub pcs_config(). So it should be simple to do. Obviously, my advice was not followed, I didn't spot the lack of it in v4 (sorry), and the result is the NULL pointer oops. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!