Netdev List
 help / color / mirror / Atom feed
* [PATCH net] nexthop: Initialize extack in remove_nh_grp_entry()
@ 2026-09-03  8:02 Ido Schimmel
  2026-09-03  8:15 ` Eric Dumazet
  2026-09-04 22:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Ido Schimmel @ 2026-09-03  8:02 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, pabeni, edumazet, dsahern, horms, kalpan.jani,
	Ido Schimmel

remove_nh_grp_entry() prints the extack message when a listener fails
to replace the reduced nexthop group. However, extack is not
initialized and listeners are not required to set a message when
returning an error. Neither netdevsim nor mlxsw do so when an
allocation fails, resulting in the dereference of an uninitialized
stack pointer.

Fix by zero-initializing extack, as was done in commit 6347c5314cee
("nexthop: initialize extack in nh_res_bucket_migrate()").

Fixes: 833a1065eeb1 ("nexthop: Emit a notification when a nexthop group is reduced")
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 net/ipv4/nexthop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
index a7c2b8dced4e..42e55b5a755e 100644
--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c
@@ -2036,7 +2036,7 @@ remove_nh_grp_entry(struct net *net, struct nh_grp_entry *nhge,
 {
 	struct nh_grp_entry *nhges, *new_nhges;
 	struct nexthop *nhp = nhge->nh_parent;
-	struct netlink_ext_ack extack;
+	struct netlink_ext_ack extack = {};
 	struct nexthop *nh = nhge->nh;
 	struct nh_group *nhg, *newg;
 	int i, j, err;
-- 
2.55.0


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

* Re: [PATCH net] nexthop: Initialize extack in remove_nh_grp_entry()
  2026-09-03  8:02 [PATCH net] nexthop: Initialize extack in remove_nh_grp_entry() Ido Schimmel
@ 2026-09-03  8:15 ` Eric Dumazet
  2026-09-04 22:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2026-09-03  8:15 UTC (permalink / raw)
  To: Ido Schimmel; +Cc: netdev, davem, kuba, pabeni, dsahern, horms, kalpan.jani

On Thu, Sep 3, 2026 at 10:03 AM Ido Schimmel <idosch@nvidia.com> wrote:
>
> remove_nh_grp_entry() prints the extack message when a listener fails
> to replace the reduced nexthop group. However, extack is not
> initialized and listeners are not required to set a message when
> returning an error. Neither netdevsim nor mlxsw do so when an
> allocation fails, resulting in the dereference of an uninitialized
> stack pointer.
>
> Fix by zero-initializing extack, as was done in commit 6347c5314cee
> ("nexthop: initialize extack in nh_res_bucket_migrate()").
>
> Fixes: 833a1065eeb1 ("nexthop: Emit a notification when a nexthop group is reduced")
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>

Reviewed-by: Eric Dumazet <edumazet@google.com>

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

* Re: [PATCH net] nexthop: Initialize extack in remove_nh_grp_entry()
  2026-09-03  8:02 [PATCH net] nexthop: Initialize extack in remove_nh_grp_entry() Ido Schimmel
  2026-09-03  8:15 ` Eric Dumazet
@ 2026-09-04 22:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-04 22:20 UTC (permalink / raw)
  To: Ido Schimmel
  Cc: netdev, davem, kuba, pabeni, edumazet, dsahern, horms,
	kalpan.jani

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu,  3 Sep 2026 11:02:59 +0300 you wrote:
> remove_nh_grp_entry() prints the extack message when a listener fails
> to replace the reduced nexthop group. However, extack is not
> initialized and listeners are not required to set a message when
> returning an error. Neither netdevsim nor mlxsw do so when an
> allocation fails, resulting in the dereference of an uninitialized
> stack pointer.
> 
> [...]

Here is the summary with links:
  - [net] nexthop: Initialize extack in remove_nh_grp_entry()
    https://git.kernel.org/netdev/net/c/5bd9e4e7cdaa

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

end of thread, other threads:[~2026-09-04 22:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-03  8:02 [PATCH net] nexthop: Initialize extack in remove_nh_grp_entry() Ido Schimmel
2026-09-03  8:15 ` Eric Dumazet
2026-09-04 22:20 ` 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