Message ID | 20230106134830.333494-1-clement.leger@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp836369wrt; Fri, 6 Jan 2023 05:56:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXuMhEtw7gobPVsR8cCA54heJbEjB0tmkMr5OAK+44ndzb0t5lv52MlBN8KC2L5BeGQ0DI7w X-Received: by 2002:a17:90b:2314:b0:221:71fb:388f with SMTP id mt20-20020a17090b231400b0022171fb388fmr63857460pjb.35.1673013375181; Fri, 06 Jan 2023 05:56:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673013375; cv=none; d=google.com; s=arc-20160816; b=HTrouH0nZ1eu2iodIV0LWh1SAnPIsiZ9WOeZkjyrdogdMvuMYy9cPjhYcu/ap8nXD7 9KzwRrwl6MebFO08NgH4dF6asrnN9PSldOhrCyPWcVLJBqsDAJ2J+02UXHYADBvYY9CK snRi1HOJ1U5Cq0hjGaAs89CtdaduGfiTuWPi8Q5S3IKW3pqBnglCOS7lEfcB0eThdb/s 3lD8fanMzewwmyCxkNWG1ySvteRcQSpT0SL8i1G8D2WqQ+2dYrAY0PuXXGz4Q4+wN+Ek DzK9UbQQTQNX7GDTFfL63492EIGouKLwNuhBGr6CQ1buTKjKN5HMw4MelBYCSDGKn0dP Y9/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=uu7OlXq7ioXd41G8rKLySQ2P+vBgHgZaa7tQBl0hBPY=; b=XN7vRMIugkJLlt61E2V/sRzeOaFvs2TPDbDXz18gttMzye4soQvIZllOUuUDq0gPe3 mp6muBpfmCXgv2hSsBX25yLQfLT54jwfDuMGkMYYYmf3sa5js6SgO1L8LqNsqaujWjEY GaShPHkBqogBjpUUB9i5scFpDgLkf0ycI/PlZzFWLOhIiqSBzu2l8jZbk8BeEYPGk916 kzs7HwzZDrnX97kIc4dERd9Xm/k/m52KrbwdiBO+hnRINdRL1IHWG1TUuUusIlTuG9jz 1bRG4eqe+KMRGYNofYdQ6KXfMQh+OIa4hwFz6HaoFMbXHQ6HfYG2Nq+Az+YNUqnXYoAg ehQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Jaw9EnR0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm13-20020a17090b3ecd00b00219044e1bbdsi1620024pjb.25.2023.01.06.05.56.03; Fri, 06 Jan 2023 05:56:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Jaw9EnR0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233789AbjAFNqf (ORCPT <rfc822;tmhikaru@gmail.com> + 99 others); Fri, 6 Jan 2023 08:46:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231146AbjAFNqd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 6 Jan 2023 08:46:33 -0500 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7282631C; Fri, 6 Jan 2023 05:46:31 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id B2E21E000F; Fri, 6 Jan 2023 13:46:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1673012790; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uu7OlXq7ioXd41G8rKLySQ2P+vBgHgZaa7tQBl0hBPY=; b=Jaw9EnR0ocZijcz73Weg51q15VpvtxO+e+sXj6TECPVfvS4t3CG5IsZSMicIGkphQrAJSR RMrI3V7yfPAys2mACw6z6a+ushF4tqEH4dunx7gWqcVg/uT6M8iAg0KNEc6J3jbaD59sTa 3Yx2v1Ii98pZFw1Wxislma4WLuAutaL7UBtIKJj2UCAf0wFbKJa8uJjzVNaK5RwMp3hAAu OshQODbT3gloiCkutv+o/Oq8gMcApGoz3lwMZubM3NJ/jBLTNHFbA0cKRbXnHGof6X41OP iwmWHJH+Ch9+0dR4fj652hMw24AqzL3JkUDNbUic+BdzyLmMApom/hc824K54A== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= <clement.leger@bootlin.com> To: Horatiu Vultur <horatiu.vultur@microchip.com>, UNGLinuxDriver@microchip.com, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Richard Cochran <richardcochran@gmail.com> Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= <clement.leger@bootlin.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit() Date: Fri, 6 Jan 2023 14:48:30 +0100 Message-Id: <20230106134830.333494-1-clement.leger@bootlin.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754281672769642389?= X-GMAIL-MSGID: =?utf-8?q?1754281672769642389?= |
Series |
net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit()
|
|
Commit Message
Clément Léger
Jan. 6, 2023, 1:48 p.m. UTC
If ptp was not enabled due to missing IRQ for instance,
lan966x_ptp_deinit() will dereference NULL pointers.
Fixes: d096459494a8 ("net: lan966x: Add support for ptp clocks")
Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c | 3 +++
1 file changed, 3 insertions(+)
Comments
The 01/06/2023 14:48, Clément Léger wrote: Hi Clement, > > If ptp was not enabled due to missing IRQ for instance, > lan966x_ptp_deinit() will dereference NULL pointers. > > Fixes: d096459494a8 ("net: lan966x: Add support for ptp clocks") > Signed-off-by: Clément Léger <clement.leger@bootlin.com> You forgot to mark the patch to target the net tree. But other than that looks good. Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> > --- > drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c > index f9ebfaafbebc..a8348437dd87 100644 > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c > @@ -1073,6 +1073,9 @@ void lan966x_ptp_deinit(struct lan966x *lan966x) > struct lan966x_port *port; > int i; > > + if (!lan966x->ptp) > + return; > + > for (i = 0; i < lan966x->num_phys_ports; i++) { > port = lan966x->ports[i]; > if (!port) > -- > 2.38.1 >
Le 2023-01-06 21:21, Horatiu Vultur a écrit : > The 01/06/2023 14:48, Clément Léger wrote: > > Hi Clement, > >> >> If ptp was not enabled due to missing IRQ for instance, >> lan966x_ptp_deinit() will dereference NULL pointers. >> >> Fixes: d096459494a8 ("net: lan966x: Add support for ptp clocks") >> Signed-off-by: Clément Léger <clement.leger@bootlin.com> > > You forgot to mark the patch to target the net tree. But other > than that looks good. Hi Horatiu, I'll resent a V2 to the net tree then. Thanks for reviewing. Clément > > Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> > >> --- >> drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c >> b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c >> index f9ebfaafbebc..a8348437dd87 100644 >> --- a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c >> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c >> @@ -1073,6 +1073,9 @@ void lan966x_ptp_deinit(struct lan966x *lan966x) >> struct lan966x_port *port; >> int i; >> >> + if (!lan966x->ptp) >> + return; >> + >> for (i = 0; i < lan966x->num_phys_ports; i++) { >> port = lan966x->ports[i]; >> if (!port) >> -- >> 2.38.1 >>
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c index f9ebfaafbebc..a8348437dd87 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c @@ -1073,6 +1073,9 @@ void lan966x_ptp_deinit(struct lan966x *lan966x) struct lan966x_port *port; int i; + if (!lan966x->ptp) + return; + for (i = 0; i < lan966x->num_phys_ports; i++) { port = lan966x->ports[i]; if (!port)