lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 11 Aug 2023 09:09:50 -0600
From: David Ahern <dsahern@...nel.org>
To: thinker.li@...il.com, davem@...emloft.net, edumazet@...gle.com,
 kuba@...nel.org, netdev@...r.kernel.org, pabeni@...hat.com,
 martin.lau@...ux.dev, kernel-team@...a.com, yhs@...a.com
Cc: sinquersw@...il.com, kuifeng@...a.com
Subject: Re: [PATCH net-next v6 1/2] net/ipv6: Remove expired routes with a
 separated list of routes.

On 8/8/23 12:03 PM, thinker.li@...il.com wrote:
> @@ -504,6 +500,49 @@ void fib6_gc_cleanup(void);
>  
>  int fib6_init(void);
>  
> +/* fib6_info must be locked by the caller, and fib6_info->fib6_table can be
> + * NULL.
> + */
> +static inline void fib6_set_expires_locked(struct fib6_info *f6i, unsigned long expires)
> +{
> +	struct fib6_table *tb6;
> +
> +	tb6 = f6i->fib6_table;
> +	f6i->expires = expires;
> +	if (tb6 && !fib6_has_expires(f6i))
> +		hlist_add_head(&f6i->gc_link, &tb6->tb6_gc_hlist);
> +	f6i->fib6_flags |= RTF_EXPIRES;
> +}
> +
> +/* fib6_info must be locked by the caller, and fib6_info->fib6_table can be
> + * NULL.  If fib6_table is NULL, the fib6_info will no be inserted into the
> + * list of GC candidates until it is inserted into a table.
> + */
> +static inline void fib6_set_expires(struct fib6_info *f6i, unsigned long expires)
> +{
> +	spin_lock_bh(&f6i->fib6_table->tb6_lock);
> +	fib6_set_expires_locked(f6i, expires);
> +	spin_unlock_bh(&f6i->fib6_table->tb6_lock);
> +}
> +
> +static inline void fib6_clean_expires_locked(struct fib6_info *f6i)
> +{
> +	struct fib6_table *tb6;
> +
> +	tb6 = f6i->fib6_table;
> +	if (tb6 && fib6_has_expires(f6i))
> +		hlist_del_init(&f6i->gc_link);

The tb6 check is not needed; if the fib6_info is on a gc list it should
be removed here.

> +	f6i->fib6_flags &= ~RTF_EXPIRES;
> +	f6i->expires = 0;
> +}
> +
> +static inline void fib6_clean_expires(struct fib6_info *f6i)
> +{
> +	spin_lock_bh(&f6i->fib6_table->tb6_lock);
> +	fib6_clean_expires_locked(f6i);
> +	spin_unlock_bh(&f6i->fib6_table->tb6_lock);
> +}
> +
>  struct ipv6_route_iter {
>  	struct seq_net_private p;
>  	struct fib6_walker w;


> diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
> index bac768d36cc1..8e86b67fe5ef 100644
> --- a/net/ipv6/ip6_fib.c
> +++ b/net/ipv6/ip6_fib.c
> @@ -1057,6 +1060,11 @@ static void fib6_purge_rt(struct fib6_info *rt, struct fib6_node *fn,
>  				    lockdep_is_held(&table->tb6_lock));
>  		}
>  	}
> +
> +	if (fib6_has_expires(rt)) {
> +		hlist_del_init(&rt->gc_link);
> +		rt->fib6_flags &= ~RTF_EXPIRES;
> +	}

Use fib6_clean_expires_locked here.

With those 2 changes:
Reviewed-by: David Ahern <dsahern@...nel.org>


--
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ