All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] net: macb: fix NULL dereference due to no pcs_config method
@ 2020-11-05 17:58 ` Parshuram Thombare
  0 siblings, 0 replies; 8+ messages in thread
From: Parshuram Thombare @ 2020-11-05 17:58 UTC (permalink / raw)
  To: nicolas.ferre, kuba, linux-arm-kernel, netdev
  Cc: Claudiu.Beznea, Santiago.Esteban, andrew, davem, linux-kernel,
	linux, harini.katakam, michal.simek, Parshuram Thombare

This patch fixes NULL pointer dereference due to NULL pcs_config
in pcs_ops.

Reported-by: Nicolas Ferre <Nicolas.Ferre@microchip.com>
Link: https://lore.kernel.org/netdev/2db854c7-9ffb-328a-f346-f68982723d29@microchip.com/
Signed-off-by: Parshuram Thombare <pthombar@cadence.com>
---
 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;
+}
+
 static const struct phylink_pcs_ops macb_phylink_usx_pcs_ops = {
 	.pcs_get_state = macb_usx_pcs_get_state,
 	.pcs_config = macb_usx_pcs_config,
@@ -642,6 +651,7 @@ static const struct phylink_pcs_ops macb_phylink_usx_pcs_ops = {
 static const struct phylink_pcs_ops macb_phylink_pcs_ops = {
 	.pcs_get_state = macb_pcs_get_state,
 	.pcs_an_restart = macb_pcs_an_restart,
+	.pcs_config = macb_pcs_config,
 };
 
 static void macb_mac_config(struct phylink_config *config, unsigned int mode,
@@ -776,10 +786,13 @@ static int macb_mac_prepare(struct phylink_config *config, unsigned int mode,
 
 	if (interface == PHY_INTERFACE_MODE_10GBASER)
 		bp->phylink_pcs.ops = &macb_phylink_usx_pcs_ops;
-	else
+	else if (interface == PHY_INTERFACE_MODE_SGMII)
 		bp->phylink_pcs.ops = &macb_phylink_pcs_ops;
+	else
+		bp->phylink_pcs.ops = NULL;
 
-	phylink_set_pcs(bp->phylink, &bp->phylink_pcs);
+	if (bp->phylink_pcs.ops)
+		phylink_set_pcs(bp->phylink, &bp->phylink_pcs);
 
 	return 0;
 }
-- 
2.7.4


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

* [RESEND PATCH] net: macb: fix NULL dereference due to no pcs_config method
@ 2020-11-05 17:58 ` Parshuram Thombare
  0 siblings, 0 replies; 8+ messages in thread
From: Parshuram Thombare @ 2020-11-05 17:58 UTC (permalink / raw)
  To: nicolas.ferre, kuba, linux-arm-kernel, netdev
  Cc: andrew, michal.simek, Parshuram Thombare, linux-kernel, linux,
	Claudiu.Beznea, Santiago.Esteban, harini.katakam, davem

This patch fixes NULL pointer dereference due to NULL pcs_config
in pcs_ops.

Reported-by: Nicolas Ferre <Nicolas.Ferre@microchip.com>
Link: https://lore.kernel.org/netdev/2db854c7-9ffb-328a-f346-f68982723d29@microchip.com/
Signed-off-by: Parshuram Thombare <pthombar@cadence.com>
---
 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;
+}
+
 static const struct phylink_pcs_ops macb_phylink_usx_pcs_ops = {
 	.pcs_get_state = macb_usx_pcs_get_state,
 	.pcs_config = macb_usx_pcs_config,
@@ -642,6 +651,7 @@ static const struct phylink_pcs_ops macb_phylink_usx_pcs_ops = {
 static const struct phylink_pcs_ops macb_phylink_pcs_ops = {
 	.pcs_get_state = macb_pcs_get_state,
 	.pcs_an_restart = macb_pcs_an_restart,
+	.pcs_config = macb_pcs_config,
 };
 
 static void macb_mac_config(struct phylink_config *config, unsigned int mode,
@@ -776,10 +786,13 @@ static int macb_mac_prepare(struct phylink_config *config, unsigned int mode,
 
 	if (interface == PHY_INTERFACE_MODE_10GBASER)
 		bp->phylink_pcs.ops = &macb_phylink_usx_pcs_ops;
-	else
+	else if (interface == PHY_INTERFACE_MODE_SGMII)
 		bp->phylink_pcs.ops = &macb_phylink_pcs_ops;
+	else
+		bp->phylink_pcs.ops = NULL;
 
-	phylink_set_pcs(bp->phylink, &bp->phylink_pcs);
+	if (bp->phylink_pcs.ops)
+		phylink_set_pcs(bp->phylink, &bp->phylink_pcs);
 
 	return 0;
 }
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [RESEND PATCH] net: macb: fix NULL dereference due to no pcs_config method
  2020-11-05 17:58 ` Parshuram Thombare
@ 2020-11-06  9:26   ` Nicolas Ferre
  -1 siblings, 0 replies; 8+ messages in thread
From: Nicolas Ferre @ 2020-11-06  9:26 UTC (permalink / raw)
  To: Parshuram Thombare, kuba, linux-arm-kernel, netdev
  Cc: Claudiu.Beznea, Santiago.Esteban, andrew, davem, linux-kernel,
	linux, harini.katakam, michal.simek

On 05/11/2020 at 18:58, Parshuram Thombare wrote:
> This patch fixes NULL pointer dereference due to NULL pcs_config
> in pcs_ops.
> 
> Reported-by: Nicolas Ferre <Nicolas.Ferre@microchip.com>
> Link: https://lore.kernel.org/netdev/2db854c7-9ffb-328a-f346-f68982723d29@microchip.com/
> Signed-off-by: Parshuram Thombare <pthombar@cadence.com>

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Thanks Parshuram, best regards,
   Nicolas

> ---
>   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;
> +}
> +
>   static const struct phylink_pcs_ops macb_phylink_usx_pcs_ops = {
>          .pcs_get_state = macb_usx_pcs_get_state,
>          .pcs_config = macb_usx_pcs_config,
> @@ -642,6 +651,7 @@ static const struct phylink_pcs_ops macb_phylink_usx_pcs_ops = {
>   static const struct phylink_pcs_ops macb_phylink_pcs_ops = {
>          .pcs_get_state = macb_pcs_get_state,
>          .pcs_an_restart = macb_pcs_an_restart,
> +       .pcs_config = macb_pcs_config,
>   };
> 
>   static void macb_mac_config(struct phylink_config *config, unsigned int mode,
> @@ -776,10 +786,13 @@ static int macb_mac_prepare(struct phylink_config *config, unsigned int mode,
> 
>          if (interface == PHY_INTERFACE_MODE_10GBASER)
>                  bp->phylink_pcs.ops = &macb_phylink_usx_pcs_ops;
> -       else
> +       else if (interface == PHY_INTERFACE_MODE_SGMII)
>                  bp->phylink_pcs.ops = &macb_phylink_pcs_ops;
> +       else
> +               bp->phylink_pcs.ops = NULL;
> 
> -       phylink_set_pcs(bp->phylink, &bp->phylink_pcs);
> +       if (bp->phylink_pcs.ops)
> +               phylink_set_pcs(bp->phylink, &bp->phylink_pcs);
> 
>          return 0;
>   }
> --
> 2.7.4
> 


-- 
Nicolas Ferre

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

* Re: [RESEND PATCH] net: macb: fix NULL dereference due to no pcs_config method
@ 2020-11-06  9:26   ` Nicolas Ferre
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Ferre @ 2020-11-06  9:26 UTC (permalink / raw)
  To: Parshuram Thombare, kuba, linux-arm-kernel, netdev
  Cc: andrew, michal.simek, linux-kernel, linux, Claudiu.Beznea,
	Santiago.Esteban, harini.katakam, davem

On 05/11/2020 at 18:58, Parshuram Thombare wrote:
> This patch fixes NULL pointer dereference due to NULL pcs_config
> in pcs_ops.
> 
> Reported-by: Nicolas Ferre <Nicolas.Ferre@microchip.com>
> Link: https://lore.kernel.org/netdev/2db854c7-9ffb-328a-f346-f68982723d29@microchip.com/
> Signed-off-by: Parshuram Thombare <pthombar@cadence.com>

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Thanks Parshuram, best regards,
   Nicolas

> ---
>   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;
> +}
> +
>   static const struct phylink_pcs_ops macb_phylink_usx_pcs_ops = {
>          .pcs_get_state = macb_usx_pcs_get_state,
>          .pcs_config = macb_usx_pcs_config,
> @@ -642,6 +651,7 @@ static const struct phylink_pcs_ops macb_phylink_usx_pcs_ops = {
>   static const struct phylink_pcs_ops macb_phylink_pcs_ops = {
>          .pcs_get_state = macb_pcs_get_state,
>          .pcs_an_restart = macb_pcs_an_restart,
> +       .pcs_config = macb_pcs_config,
>   };
> 
>   static void macb_mac_config(struct phylink_config *config, unsigned int mode,
> @@ -776,10 +786,13 @@ static int macb_mac_prepare(struct phylink_config *config, unsigned int mode,
> 
>          if (interface == PHY_INTERFACE_MODE_10GBASER)
>                  bp->phylink_pcs.ops = &macb_phylink_usx_pcs_ops;
> -       else
> +       else if (interface == PHY_INTERFACE_MODE_SGMII)
>                  bp->phylink_pcs.ops = &macb_phylink_pcs_ops;
> +       else
> +               bp->phylink_pcs.ops = NULL;
> 
> -       phylink_set_pcs(bp->phylink, &bp->phylink_pcs);
> +       if (bp->phylink_pcs.ops)
> +               phylink_set_pcs(bp->phylink, &bp->phylink_pcs);
> 
>          return 0;
>   }
> --
> 2.7.4
> 


-- 
Nicolas Ferre

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [RESEND PATCH] net: macb: fix NULL dereference due to no pcs_config method
  2020-11-06  9:26   ` Nicolas Ferre
@ 2020-11-07 21:24     ` Jakub Kicinski
  -1 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2020-11-07 21:24 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Parshuram Thombare, linux-arm-kernel, netdev, Claudiu.Beznea,
	Santiago.Esteban, andrew, davem, linux-kernel, linux,
	harini.katakam, michal.simek

On Fri, 6 Nov 2020 10:26:59 +0100 Nicolas Ferre wrote:
> On 05/11/2020 at 18:58, Parshuram Thombare wrote:
> > This patch fixes NULL pointer dereference due to NULL pcs_config
> > in pcs_ops.
> > 
> > Reported-by: Nicolas Ferre <Nicolas.Ferre@microchip.com>
> > Link: https://lore.kernel.org/netdev/2db854c7-9ffb-328a-f346-f68982723d29@microchip.com/
> > Signed-off-by: Parshuram Thombare <pthombar@cadence.com>  
> 
> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Applied.

I brought back the fixes tag from the first posting. It's entirely
reasonable to add fixes tags from the tree you're targeting as long 
as that tree guarantees commit hashes are stable and won't change on
their way upstream. Which is the case for net and net-next trees.

Thanks!

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

* Re: [RESEND PATCH] net: macb: fix NULL dereference due to no pcs_config method
@ 2020-11-07 21:24     ` Jakub Kicinski
  0 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2020-11-07 21:24 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: andrew, michal.simek, Parshuram Thombare, netdev, linux-kernel,
	davem, Santiago.Esteban, harini.katakam, linux, Claudiu.Beznea,
	linux-arm-kernel

On Fri, 6 Nov 2020 10:26:59 +0100 Nicolas Ferre wrote:
> On 05/11/2020 at 18:58, Parshuram Thombare wrote:
> > This patch fixes NULL pointer dereference due to NULL pcs_config
> > in pcs_ops.
> > 
> > Reported-by: Nicolas Ferre <Nicolas.Ferre@microchip.com>
> > Link: https://lore.kernel.org/netdev/2db854c7-9ffb-328a-f346-f68982723d29@microchip.com/
> > Signed-off-by: Parshuram Thombare <pthombar@cadence.com>  
> 
> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Applied.

I brought back the fixes tag from the first posting. It's entirely
reasonable to add fixes tags from the tree you're targeting as long 
as that tree guarantees commit hashes are stable and won't change on
their way upstream. Which is the case for net and net-next trees.

Thanks!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [RESEND PATCH] net: macb: fix NULL dereference due to no pcs_config method
  2020-11-05 17:58 ` Parshuram Thombare
@ 2020-11-07 21:30   ` patchwork-bot+netdevbpf
  -1 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-11-07 21:30 UTC (permalink / raw)
  To: Parshuram Thombare
  Cc: nicolas.ferre, kuba, linux-arm-kernel, netdev, Claudiu.Beznea,
	Santiago.Esteban, andrew, davem, linux-kernel, linux,
	harini.katakam, michal.simek

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Thu, 5 Nov 2020 18:58:33 +0100 you wrote:
> This patch fixes NULL pointer dereference due to NULL pcs_config
> in pcs_ops.
> 
> Reported-by: Nicolas Ferre <Nicolas.Ferre@microchip.com>
> Link: https://lore.kernel.org/netdev/2db854c7-9ffb-328a-f346-f68982723d29@microchip.com/
> Signed-off-by: Parshuram Thombare <pthombar@cadence.com>
> 
> [...]

Here is the summary with links:
  - [RESEND] net: macb: fix NULL dereference due to no pcs_config method
    https://git.kernel.org/netdev/net-next/c/0012eeb370f8

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [RESEND PATCH] net: macb: fix NULL dereference due to no pcs_config method
@ 2020-11-07 21:30   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-11-07 21:30 UTC (permalink / raw)
  To: Parshuram Thombare
  Cc: andrew, linux-kernel, linux, netdev, michal.simek, davem,
	Santiago.Esteban, harini.katakam, kuba, Claudiu.Beznea,
	linux-arm-kernel

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Thu, 5 Nov 2020 18:58:33 +0100 you wrote:
> This patch fixes NULL pointer dereference due to NULL pcs_config
> in pcs_ops.
> 
> Reported-by: Nicolas Ferre <Nicolas.Ferre@microchip.com>
> Link: https://lore.kernel.org/netdev/2db854c7-9ffb-328a-f346-f68982723d29@microchip.com/
> Signed-off-by: Parshuram Thombare <pthombar@cadence.com>
> 
> [...]

Here is the summary with links:
  - [RESEND] net: macb: fix NULL dereference due to no pcs_config method
    https://git.kernel.org/netdev/net-next/c/0012eeb370f8

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-11-07 21:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 17:58 [RESEND PATCH] net: macb: fix NULL dereference due to no pcs_config method Parshuram Thombare
2020-11-05 17:58 ` Parshuram Thombare
2020-11-06  9:26 ` Nicolas Ferre
2020-11-06  9:26   ` Nicolas Ferre
2020-11-07 21:24   ` Jakub Kicinski
2020-11-07 21:24     ` Jakub Kicinski
2020-11-07 21:30 ` patchwork-bot+netdevbpf
2020-11-07 21:30   ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.