linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit()
@ 2023-01-06 13:48 Clément Léger
  2023-01-06 20:21 ` Horatiu Vultur
  0 siblings, 1 reply; 3+ messages in thread
From: Clément Léger @ 2023-01-06 13:48 UTC (permalink / raw)
  To: Horatiu Vultur, UNGLinuxDriver, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran
  Cc: Clément Léger, netdev, linux-kernel

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(+)

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit()
  2023-01-06 13:48 [PATCH] net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit() Clément Léger
@ 2023-01-06 20:21 ` Horatiu Vultur
  2023-01-06 20:24   ` clement.leger
  0 siblings, 1 reply; 3+ messages in thread
From: Horatiu Vultur @ 2023-01-06 20:21 UTC (permalink / raw)
  To: Clément Léger
  Cc: UNGLinuxDriver, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Richard Cochran, netdev, linux-kernel

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
> 

-- 
/Horatiu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit()
  2023-01-06 20:21 ` Horatiu Vultur
@ 2023-01-06 20:24   ` clement.leger
  0 siblings, 0 replies; 3+ messages in thread
From: clement.leger @ 2023-01-06 20:24 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: UNGLinuxDriver, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Richard Cochran, netdev, linux-kernel

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
>> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-06 20:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 13:48 [PATCH] net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit() Clément Léger
2023-01-06 20:21 ` Horatiu Vultur
2023-01-06 20:24   ` clement.leger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).