[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170316.111647.1545474188593011995.davem@davemloft.net>
Date: Thu, 16 Mar 2017 11:16:47 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: kaiwen.xu@...u.com
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] [PATCH net] net: Do not hold the reference for the
same sk_rx_dst.
From: Kevin Xu <kaiwen.xu@...u.com>
Date: Thu, 16 Mar 2017 01:08:30 -0700
> In some rare cases, inet_sk_rx_dst_set() may be called multiple times
> on the same dst, causing reference count leakage. Eventually, it
> prevents net_device to be destroyed. The bug then manifested as
>
> unregister_netdevice: waiting for lo to become free. Usage count = 1
>
> in the kernel log, preventing new network namespace creation.
>
> The patch works around the issue by checking whether the socket already
> has the same dst set.
>
> Signed-off-by: Kevin Xu <kaiwen.xu@...u.com>
You need to prevent this parallel execution of this function or use
atomic compare-and-exchange to set the rx_dst in order to prevent
the double refcounting.
This patch by itself is even worse than a workaround, because depending
upon how the compiler reloads values from memory, the problem can still
occur.
Powered by blists - more mailing lists