mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Petr Pavlu <petr.pavlu@suse.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Kui-Feng Lee <thinker.li@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] net/ipv6: Fix the RT cache flush via sysctl using a previous delay
Date: Mon, 10 Jun 2024 09:26:34 -0600	[thread overview]
Message-ID: <aa571ef1-80dc-4a20-8726-65193b565728@kernel.org> (raw)
In-Reply-To: <20240607112828.30285-1-petr.pavlu@suse.com>

On 6/7/24 5:28 AM, Petr Pavlu wrote:
> The net.ipv6.route.flush system parameter takes a value which specifies
> a delay used during the flush operation for aging exception routes. The
> written value is however not used in the currently requested flush and
> instead utilized only in the next one.
> 
> A problem is that ipv6_sysctl_rtcache_flush() first reads the old value
> of net->ipv6.sysctl.flush_delay into a local delay variable and then
> calls proc_dointvec() which actually updates the sysctl based on the
> provided input.
> 
> Fix the problem by switching the order of the two operations.
> 
> Fixes: 4990509f19e8 ("[NETNS][IPV6]: Make sysctls route per namespace.")
> Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
> ---
> 
> Changes since v1 [1]:
> - Minimize the fix, correct only the order of operations in
>   ipv6_sysctl_rtcache_flush().
> 
> [1] https://lore.kernel.org/netdev/20240529135251.4074-1-petr.pavlu@suse.com/
> 
>  net/ipv6/route.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index f083d9faba6b..952c2bf11709 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -6343,12 +6343,12 @@ static int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write,
>  	if (!write)
>  		return -EINVAL;
>  
> -	net = (struct net *)ctl->extra1;
> -	delay = net->ipv6.sysctl.flush_delay;
>  	ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
>  	if (ret)
>  		return ret;
>  
> +	net = (struct net *)ctl->extra1;
> +	delay = net->ipv6.sysctl.flush_delay;
>  	fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0);
>  	return 0;
>  }
> 
> base-commit: 8a92980606e3585d72d510a03b59906e96755b8a


Reviewed-by: David Ahern <dsahern@kernel.org>


  reply	other threads:[~2024-06-10 15:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07 11:28 Petr Pavlu
2024-06-10 15:26 ` David Ahern [this message]
2024-06-13  1:00 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aa571ef1-80dc-4a20-8726-65193b565728@kernel.org \
    --to=dsahern@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petr.pavlu@suse.com \
    --cc=thinker.li@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®