netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: macb: fix the restore of cmp registers
@ 2021-04-14 11:20 Claudiu Beznea
  2021-04-14 21:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Claudiu Beznea @ 2021-04-14 11:20 UTC (permalink / raw)
  To: nicolas.ferre, davem, kuba; +Cc: netdev, linux-kernel, Claudiu Beznea

Commit a14d273ba159 ("net: macb: restore cmp registers on resume path")
introduces the restore of CMP registers on resume path. In case the IP
doesn't support type 2 screeners (zero on DCFG8 register) the
struct macb::rx_fs_list::list is not initialized and thus the
list_for_each_entry(item, &bp->rx_fs_list.list, list) loop introduced in
commit a14d273ba159 ("net: macb: restore cmp registers on resume path")
will access an uninitialized list leading to crash. Thus, initialize
the struct macb::rx_fs_list::list without taking into account if the
IP supports type 2 screeners or not.

Fixes: a14d273ba159 ("net: macb: restore cmp registers on resume path")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/net/ethernet/cadence/macb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index c36722541bc4..0db538d089b1 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -3926,6 +3926,7 @@ static int macb_init(struct platform_device *pdev)
 	reg = gem_readl(bp, DCFG8);
 	bp->max_tuples = min((GEM_BFEXT(SCR2CMP, reg) / 3),
 			GEM_BFEXT(T2SCR, reg));
+	INIT_LIST_HEAD(&bp->rx_fs_list.list);
 	if (bp->max_tuples > 0) {
 		/* also needs one ethtype match to check IPv4 */
 		if (GEM_BFEXT(SCR2ETH, reg) > 0) {
@@ -3938,7 +3939,6 @@ static int macb_init(struct platform_device *pdev)
 			/* Filtering is supported in hw but don't enable it in kernel now */
 			dev->hw_features |= NETIF_F_NTUPLE;
 			/* init Rx flow definitions */
-			INIT_LIST_HEAD(&bp->rx_fs_list.list);
 			bp->rx_fs_list.count = 0;
 			spin_lock_init(&bp->rx_fs_lock);
 		} else
-- 
2.25.1


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

* Re: [PATCH] net: macb: fix the restore of cmp registers
  2021-04-14 11:20 [PATCH] net: macb: fix the restore of cmp registers Claudiu Beznea
@ 2021-04-14 21:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-14 21:10 UTC (permalink / raw)
  To: Claudiu Beznea; +Cc: nicolas.ferre, davem, kuba, netdev, linux-kernel

Hello:

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

On Wed, 14 Apr 2021 14:20:29 +0300 you wrote:
> Commit a14d273ba159 ("net: macb: restore cmp registers on resume path")
> introduces the restore of CMP registers on resume path. In case the IP
> doesn't support type 2 screeners (zero on DCFG8 register) the
> struct macb::rx_fs_list::list is not initialized and thus the
> list_for_each_entry(item, &bp->rx_fs_list.list, list) loop introduced in
> commit a14d273ba159 ("net: macb: restore cmp registers on resume path")
> will access an uninitialized list leading to crash. Thus, initialize
> the struct macb::rx_fs_list::list without taking into account if the
> IP supports type 2 screeners or not.
> 
> [...]

Here is the summary with links:
  - net: macb: fix the restore of cmp registers
    https://git.kernel.org/netdev/net/c/a714e27ea8bd

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] 2+ messages in thread

end of thread, other threads:[~2021-04-14 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14 11:20 [PATCH] net: macb: fix the restore of cmp registers Claudiu Beznea
2021-04-14 21:10 ` patchwork-bot+netdevbpf

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