[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e0c5f95f-518d-ba07-a3bb-99f14515fc6d@gmail.com>
Date: Fri, 8 Mar 2019 08:33:04 -0700
From: David Ahern <dsahern@...il.com>
To: Xin Long <lucien.xin@...il.com>,
network dev <netdev@...r.kernel.org>
Cc: davem@...emloft.net, Jon Maxwell <jmaxwell37@...il.com>,
jmaxwell@...hat.com
Subject: Re: [PATCH net] route: set the deleted fnhe fnhe_daddr to 0 in
ip_del_fnhe to fix a race
On 3/7/19 11:50 PM, Xin Long wrote:
> The race occurs in __mkroute_output() when 2 threads lookup a dst:
>
> CPU A CPU B
> find_exception()
> find_exception() [fnhe expires]
> ip_del_fnhe() [fnhe is deleted]
> rt_bind_exception()
>
> In rt_bind_exception() it will bind a deleted fnhe with the new dst, and
> this dst will get no chance to be freed. It causes a dev defcnt leak and
> consecutive dmesg warnings:
>
> unregister_netdevice: waiting for ethX to become free. Usage count = 1
>
> Especially thinks Jon to identify the issue.
>
> This patch fixes it by setting fnhe_daddr to 0 in ip_del_fnhe() to stop
> binding the deleted fnhe with a new dst when checking fnhe's fnhe_daddr
> and daddr in rt_bind_exception().
>
> It works as both ip_del_fnhe() and rt_bind_exception() are protected by
> fnhe_lock and the fhne is freed by kfree_rcu().
>
> Fixes: deed49df7390 ("route: check and remove route cache when we get route")
> Signed-off-by: Jon Maxwell <jmaxwell37@...il.com>
> Signed-off-by: Xin Long <lucien.xin@...il.com>
> ---
> net/ipv4/route.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
Reviewed-by: David Ahern <dsahern@...il.com>
Powered by blists - more mailing lists