]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
devlink: fix netns refcount leak in devlink_nl_cmd_reload()
authorEric Dumazet <edumazet@google.com>
Sun, 5 Dec 2021 19:28:22 +0000 (11:28 -0800)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:49:15 +0000 (09:49 +0100)
commitec7d1e365604de0ff307614f55eacc73ce4355a8
treec26e991ff294ebcb641327cc187c6646ae518072
parent88ca61af7b31fbdcc054e0bfd15db77b87474efb
devlink: fix netns refcount leak in devlink_nl_cmd_reload()

BugLink: https://bugs.launchpad.net/bugs/1954931
commit 4dbb0dad8e63fcd0b5a117c2861d2abe7ff5f186 upstream.

While preparing my patch series adding netns refcount tracking,
I spotted bugs in devlink_nl_cmd_reload()

Some error paths forgot to release a refcount on a netns.

To fix this, we can reduce the scope of get_net()/put_net()
section around the call to devlink_reload().

Fixes: ccdf07219da6 ("devlink: Add reload action option to devlink reload command")
Fixes: dc64cc7c6310 ("devlink: Add devlink reload limit option")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Moshe Shemesh <moshe@mellanox.com>
Cc: Jacob Keller <jacob.e.keller@intel.com>
Cc: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20211205192822.1741045-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
net/core/devlink.c