Re: [PATCH net-next 03/14] ipv6: annotate data-races around addrconf sysctls
From: Simon Horman
Date: Fri Nov 13 2026 - 16:17:29 EST
On Mon, Nov 09, 2026 at 10:52:02AM +0800, Jiayuan Chen wrote:
...
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
...
> @@ -2857,7 +2859,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
> return;
> }
>
> - if (valid_lft != 0 && valid_lft < in6_dev->cnf.accept_ra_min_lft)
> + if (valid_lft != 0 && valid_lft < READ_ONCE(in6_dev->cnf.accept_ra_min_lft))
Hi Jiayuan,
This patch introduces several lines that are longer than 80 columns,
while Networking code still prefers lines 80 columns wide or less.
I'd appreciated it if this could be addressed.
In this case, I think that could look like this (completely untested):
if (valid_lft != 0 &&
alid_lft < READ_ONCE(in6_dev->cnf.accept_ra_min_lft))
> goto put;
>
> /*
> @@ -2928,7 +2930,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
> /* Try to figure out our local address for this prefix */
>
> ignore_autoconf = READ_ONCE(in6_dev->cnf.ra_honor_pio_pflag) && pinfo->preferpd;
> - if (pinfo->autoconf && in6_dev->cnf.autoconf && !ignore_autoconf) {
> + if (pinfo->autoconf && READ_ONCE(in6_dev->cnf.autoconf) && !ignore_autoconf) {
> struct in6_addr addr;
> bool tokenized = false, dev_addr_generated = false;
>
Similarly here.
> @@ -3434,7 +3436,7 @@ static int ipv6_generate_stable_address(struct in6_addr *address,
>
> if (ipv6_reserved_interfaceid(temp)) {
> dad_count++;
> - if (dad_count > dev_net(idev->dev)->ipv6.sysctl.idgen_retries)
> + if (dad_count > READ_ONCE(dev_net(idev->dev)->ipv6.sysctl.idgen_retries))
> return -1;
> goto retry;
> }
And I wonder if in this case we could do something like (completely untested):
if (ipv6_reserved_interfaceid(temp)) {
const struct *net net = dev_net(idev->dev)
dad_count++;
if (dad_count > READ_ONCE(net->ipv6.sysctl.idgen_retries))
return -1;
goto retry;
}
...