All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] devlink: fix net namespace reference leak in reload
@ 2026-07-29  8:06 Tariq Toukan
  2026-07-29 10:23 ` Antoine Tenart
  2026-08-01  1:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Tariq Toukan @ 2026-07-29  8:06 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni
  Cc: Gal Pressman, Jiri Pirko, Jiri Pirko, linux-kernel, Or Har-Toov,
	Simon Horman, Tariq Toukan

From: Or Har-Toov <ohartoov@nvidia.com>

devlink_nl_reload_doit() calls devlink_netns_get(), which returns a net
with a held reference. When the requested namespace differs from the
current one and the reload action is not DRIVER_REINIT, the function
returns -EOPNOTSUPP without releasing the reference. Add the missing
put_net() on this error path.

Fixes: 2edd92570441 ("devlink: don't allow to change net namespace for FW_ACTIVATE reload action")
Signed-off-by: Or Har-Toov <ohartoov@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 net/devlink/dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/devlink/dev.c b/net/devlink/dev.c
index 57b2b8f03543..fd5633fa88ec 100644
--- a/net/devlink/dev.c
+++ b/net/devlink/dev.c
@@ -578,6 +578,7 @@ int devlink_nl_reload_doit(struct sk_buff *skb, struct genl_info *info)
 		    action != DEVLINK_RELOAD_ACTION_DRIVER_REINIT) {
 			NL_SET_ERR_MSG_MOD(info->extack,
 					   "Changing namespace is only supported for reinit action");
+			put_net(dest_net);
 			return -EOPNOTSUPP;
 		}
 	}

base-commit: 3bd438a58e910db5dc369aa25dfed1fc95f1b596
-- 
2.44.0


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

* Re: [PATCH net] devlink: fix net namespace reference leak in reload
  2026-07-29  8:06 [PATCH net] devlink: fix net namespace reference leak in reload Tariq Toukan
@ 2026-07-29 10:23 ` Antoine Tenart
  2026-08-01  1:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Antoine Tenart @ 2026-07-29 10:23 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni, Gal Pressman, Jiri Pirko, Jiri Pirko,
	linux-kernel, Or Har-Toov, Simon Horman

On Wed, Jul 29, 2026 at 11:06:00AM +0300, Tariq Toukan wrote:
> From: Or Har-Toov <ohartoov@nvidia.com>
> 
> devlink_nl_reload_doit() calls devlink_netns_get(), which returns a net
> with a held reference. When the requested namespace differs from the
> current one and the reload action is not DRIVER_REINIT, the function
> returns -EOPNOTSUPP without releasing the reference. Add the missing
> put_net() on this error path.
> 
> Fixes: 2edd92570441 ("devlink: don't allow to change net namespace for FW_ACTIVATE reload action")
> Signed-off-by: Or Har-Toov <ohartoov@nvidia.com>
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>

Reviewed-by: Antoine Tenart <atenart@kernel.org>

> ---
>  net/devlink/dev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/devlink/dev.c b/net/devlink/dev.c
> index 57b2b8f03543..fd5633fa88ec 100644
> --- a/net/devlink/dev.c
> +++ b/net/devlink/dev.c
> @@ -578,6 +578,7 @@ int devlink_nl_reload_doit(struct sk_buff *skb, struct genl_info *info)
>  		    action != DEVLINK_RELOAD_ACTION_DRIVER_REINIT) {
>  			NL_SET_ERR_MSG_MOD(info->extack,
>  					   "Changing namespace is only supported for reinit action");
> +			put_net(dest_net);
>  			return -EOPNOTSUPP;
>  		}
>  	}
> 
> base-commit: 3bd438a58e910db5dc369aa25dfed1fc95f1b596
> -- 
> 2.44.0
> 

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

* Re: [PATCH net] devlink: fix net namespace reference leak in reload
  2026-07-29  8:06 [PATCH net] devlink: fix net namespace reference leak in reload Tariq Toukan
  2026-07-29 10:23 ` Antoine Tenart
@ 2026-08-01  1:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-01  1:40 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: andrew+netdev, davem, edumazet, kuba, netdev, pabeni, gal, jiri,
	jiri, linux-kernel, ohartoov, horms

Hello:

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

On Wed, 29 Jul 2026 11:06:00 +0300 you wrote:
> From: Or Har-Toov <ohartoov@nvidia.com>
> 
> devlink_nl_reload_doit() calls devlink_netns_get(), which returns a net
> with a held reference. When the requested namespace differs from the
> current one and the reload action is not DRIVER_REINIT, the function
> returns -EOPNOTSUPP without releasing the reference. Add the missing
> put_net() on this error path.
> 
> [...]

Here is the summary with links:
  - [net] devlink: fix net namespace reference leak in reload
    https://git.kernel.org/netdev/net/c/1c4dac9bf1d2

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-08-01  1:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29  8:06 [PATCH net] devlink: fix net namespace reference leak in reload Tariq Toukan
2026-07-29 10:23 ` Antoine Tenart
2026-08-01  1:40 ` 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.