diff options
author | Eric Dumazet <edumazet@google.com> | 2024-04-16 14:07:39 +0000 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-04-17 18:30:28 -0700 |
commit | 1514b06aff1681a418089060f0ebe936c27481bc (patch) | |
tree | 5956a0d8af59e101b83d467a28cc096d1c8670bd /net | |
parent | 860a9bed265146b10311bcadbbcef59c3af4454d (diff) |
netns: no longer hold RTNL in rtnl_net_dumpid()
- rtnl_net_dumpid() is already fully RCU protected,
RTNL is not needed there.
- Fix return value at the end of a dump,
so that NLMSG_DONE can be appended to current skb,
saving one recvmsg() system call.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Link: https://lore.kernel.org/r/20240416140739.967941-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/net_namespace.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index f0540c557515..2f5190aa2f15 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -1090,7 +1090,7 @@ static int rtnl_net_dumpid(struct sk_buff *skb, struct netlink_callback *cb) end: if (net_cb.fillargs.add_ref) put_net(net_cb.tgt_net); - return err < 0 ? err : skb->len; + return err; } static void rtnl_net_notifyid(struct net *net, int cmd, int id, u32 portid, @@ -1205,7 +1205,8 @@ void __init net_ns_init(void) rtnl_register(PF_UNSPEC, RTM_NEWNSID, rtnl_net_newid, NULL, RTNL_FLAG_DOIT_UNLOCKED); rtnl_register(PF_UNSPEC, RTM_GETNSID, rtnl_net_getid, rtnl_net_dumpid, - RTNL_FLAG_DOIT_UNLOCKED); + RTNL_FLAG_DOIT_UNLOCKED | + RTNL_FLAG_DUMP_UNLOCKED); } static void free_exit_list(struct pernet_operations *ops, struct list_head *net_exit_list) |