ipv6: remove RTNL protection from ip6addrlbl_dump()
authorEric Dumazet <edumazet@google.com>
Thu, 4 Apr 2024 13:24:13 +0000 (13:24 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Apr 2024 10:01:05 +0000 (11:01 +0100)
commiteec53cc38c4aba41bc3fabd0a75bc30c2c8ea332
tree671b02db22453cf2682e0c64a3ba35f007abeb11
parent802e12ff9cbff3bafb0b6f0fe79cff04dce9de16
ipv6: remove RTNL protection from ip6addrlbl_dump()

No longer hold RTNL while calling ip6addrlbl_dump()
("ip addrlabel show")

ip6addrlbl_dump() was already mostly relying on RCU anyway.

Add READ_ONCE()/WRITE_ONCE() annotations around
net->ipv6.ip6addrlbl_table.seq

Note that ifal_seq value is currently ignored in iproute2,
and a bit weak.

We might user later cb->seq  / nl_dump_check_consistent()
protocol if needed.

Also change return value for a completed dump,
so that NLMSG_DONE can be appended to current skb,
saving one recvmsg() system call.

v2: read net->ipv6.ip6addrlbl_table.seq once, (David Ahern)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link:https://lore.kernel.org/netdev/67f5cb70-14a4-4455-8372-f039da2f15c2@kernel.org/
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/addrlabel.c