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=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 5FA84C55178 for ; Thu, 5 Nov 2020 15:53:27 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DDF2820782 for ; Thu, 5 Nov 2020 15:53:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mkpbM7hV"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="xYu0g69d" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDF2820782 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HhHOpJn/nC2+odgV1vW43L1sd73XXVS2HgYhqZT/FZ8=; b=mkpbM7hV7I18E3MkX3KW0U5BZ qWBBgx+PFtJuZiQ/yNfyr4EdRYYGvKIGHNnn2ZDF54AREmcBothU2RkqPBvtBheQsE0jLElZ5oqpp 3cMk5LpaTVg4m1D+bZDJRm2sT41QKi6a0gI4tFUmcikpmIWl3l3NxGujnCvpBAghCDbJLsc6htg7o ad8IC6QzxRTunNGzo8SmfXNTcDijl8T/SrzWxq6m4PUn+ArC9to14Et4DHw+HUHx6b78yq6EfpemD nIPa01yHvJEcwgMzIXFi1EmR/WxypUVjejSJEgQnt4TNBToNHHkIzy9Xinb//R6uV2wyXWouEOrA1 e/I31CBbw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kahYf-0008MZ-Qk; Thu, 05 Nov 2020 15:52:17 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kahYd-00086Q-0R for linux-arm-kernel@lists.infradead.org; Thu, 05 Nov 2020 15:52:16 +0000 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 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-Disposition: inline In-Reply-To: <6873cf12-456b-c121-037b-d2c5a6138cb3@microchip.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201105_105215_097201_879A825F X-CRM114-Status: GOOD ( 27.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, michal.simek@xilinx.com, Parshuram Thombare , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, Santiago.Esteban@microchip.com, harini.katakam@xilinx.com, kuba@kernel.org, Claudiu.Beznea@microchip.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel