mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: prestera: return error on hash table init failure
@ 2026-09-14 11:20 Elad Nachman
  2026-09-15 23:55 ` Jacob Keller
  2026-09-16  1:35 ` netdev-bot+sashiko
  0 siblings, 2 replies; 3+ messages in thread
From: Elad Nachman @ 2026-09-14 11:20 UTC (permalink / raw)
  To: enachman, andrew+netdev, davem, edumazet, kuba, pabeni,
	yevhen.orlov, taras.chornyi, oleksandr.mazur, netdev,
	linux-kernel
  Cc: Dan Carpenter

From: Elad Nachman <enachman@marvell.com>

prestera_router_hw_init() calls rhashtable_destroy() on error but then
still returns success. This causes prestera_router_init() to continue
without error, going through line 1623, and call
prestera_router_hw_fini(sw), which will cause dereferencing of freed memory
'sw->router->nexthop_group_ht.tbl' at line 1560.

Fixes: 0a23ae237171 ("net: marvell: prestera: Add router nexthops ABI")
Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/kernel-janitors/aqT9h61WBcslE0gJ@stanley.mountain
Signed-off-by: Elad Nachman <enachman@marvell.com>
---
 drivers/net/ethernet/marvell/prestera/prestera_router_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/prestera/prestera_router_hw.c b/drivers/net/ethernet/marvell/prestera/prestera_router_hw.c
index ccf6cf98920f..4785fcb62735 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_router_hw.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_router_hw.c
@@ -93,7 +93,7 @@ int prestera_router_hw_init(struct prestera_switch *sw)
 err_nexthop_grp_ht_init:
 	rhashtable_destroy(&sw->router->nh_neigh_ht);
 err_nh_neigh_ht_init:
-	return 0;
+	return err;
 }
 
 void prestera_router_hw_fini(struct prestera_switch *sw)
-- 
2.25.1


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

end of thread, other threads:[~2026-09-16  1:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 11:20 [PATCH] net: prestera: return error on hash table init failure Elad Nachman
2026-09-15 23:55 ` Jacob Keller
2026-09-16  1:35 ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®