Message ID | 20230109153223.390015-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 p1csp2220847wrt; Mon, 9 Jan 2023 07:33:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXsMrV2N1NKXjU3vr14J5AHvagGTnlAOTxhuiBlBrCIgv+sRpKeoyvhS3uXc3JT2v7YQtYAX X-Received: by 2002:a17:902:ed11:b0:193:38a1:68e4 with SMTP id b17-20020a170902ed1100b0019338a168e4mr1651945pld.0.1673278408401; Mon, 09 Jan 2023 07:33:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673278408; cv=none; d=google.com; s=arc-20160816; b=TRwPY7lpu7aTC98ev9SjVEfkjHEPpjGSWrfQED0PgyjCkQiFjUV82qCY33OpBGlVVX HuExbr7wJBaFXhwz9/Nh5ylGl8DYuH2ocx1qFhy/6ItHhaekFXMct6tNX/2Os5aC+zVA e373dlE0jLsmk0el8NXNnAPWsHoROb/n0y9d2tKWyKpLUj6vBcjbWvUrsviNruWahCwA 4bYBIXY3Pwew4V+Wp1lQL41gbgVU9q1+1RrKUAIgvtbCdAOi30Tc5xRfNRJwiCBcFAO2 4K12YvbA0OZWL9brm0b4QPkm4t6UmUTaoxL4tMbtqJhoxKv/uGuhviHrMVugU87CZLqI XSQA== 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=JeLio8yD9weT4NXy3rfTtYARl8N0adDQIDkmNvJp3nU=; b=WPaXnT4Zgt5U+nLMoAqATrEQQUTLpY0AUaeiJwv3j/fb42UUxPbYnDHNWv+uPmY+T+ BNgN/HVd+qHvkezuoBgS0mmlMl67QD6PEkIFxkvY8EZwERfj2oX7FFjOCfsrQtFdTLFy 7gKUT3wYYWiapylpjscmRGAdb7fDFF1XnEFvx3KCDhScEGswlvzqQck2R+uXvOtpGWon 86yLececr1YHJutD1PtuTSyj/E+aL2QPJ4n3nTlBWl+Cps8NvSAG1AGJ+5L2xmINFK4k OvVRcoaXGniPQAIcKoeoVEjinfDUhr0fQCBZxM5BEQ8FetG/D8eaiXGqjcrrMjNfOda1 RC7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=mIyU7ZXD; 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 ba11-20020a170902720b00b0019329597730si4919392plb.378.2023.01.09.07.33.14; Mon, 09 Jan 2023 07:33:28 -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=mIyU7ZXD; 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 S237280AbjAIPbd (ORCPT <rfc822;274620705z@gmail.com> + 99 others); Mon, 9 Jan 2023 10:31:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237226AbjAIPbF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 9 Jan 2023 10:31:05 -0500 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::222]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82B69395FB; Mon, 9 Jan 2023 07:30:37 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id CC5B84000A; Mon, 9 Jan 2023 15:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1673278235; 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=JeLio8yD9weT4NXy3rfTtYARl8N0adDQIDkmNvJp3nU=; b=mIyU7ZXDjmnd8giwcY7EM1bkXO01Tc0pmsrh62pwu6zKiJA2BV238+2nuey7QHPIuPEBYO eFwcnnqAihoAMQFIQTzAgXo56OSd1PofvhYKx2l/p1vLJy3c7LZwFQm9ZinXHz0E8dmRyW m0YAJGfDd1tAWfKP36jt7yYfCwU5rddXa3EfRhQnSrkjPtA+uepw8DcNmldlLyMd0khZ8e BkVxG9tU7yO1/i9cRdbA2NE8PvI8IWTXVHM56iIoNd69jTnDhTtvsLX3uPo5Q2LrOgP0n2 u9HrT1kssWqEFRb4JOJY7PecH+cxAV13YzV1DFwtC5gkSVWO4fqtOXLJwsR8Ig== 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 v2] net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit() Date: Mon, 9 Jan 2023 16:32:23 +0100 Message-Id: <20230109153223.390015-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,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?1754559580566264657?= X-GMAIL-MSGID: =?utf-8?q?1754559580566264657?= |
Series |
[net,v2] net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit()
|
|
Commit Message
Clément Léger
Jan. 9, 2023, 3:32 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> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> --- Changes in v2: - Added Reviewed-by: Horatiu Vultur - Added net in patch subject to target net tree drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c | 3 +++ 1 file changed, 3 insertions(+)
Comments
Mon, Jan 09, 2023 at 04:32:23PM CET, clement.leger@bootlin.com wrote: >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> >Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Hello: This patch was applied to netdev/net.git (master) by David S. Miller <davem@davemloft.net>: On Mon, 9 Jan 2023 16:32:23 +0100 you wrote: > 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> > Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> > > [...] Here is the summary with links: - [net,v2] net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit() https://git.kernel.org/netdev/net/c/b0e380b5d427 You are awesome, thank you!
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)