[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZREdhN1hl6+6Eic2@gauss3.secunet.de>
Date: Mon, 25 Sep 2023 07:41:24 +0200
From: Steffen Klassert <steffen.klassert@...unet.com>
To: Zhang Changzhong <zhangchangzhong@...wei.com>
CC: Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Xin Long <lucien.xin@...il.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net] xfrm6: fix inet6_dev refcount underflow problem
On Fri, Sep 15, 2023 at 07:20:41PM +0800, Zhang Changzhong wrote:
> There are race conditions that may lead to inet6_dev refcount underflow
> in xfrm6_dst_destroy() and rt6_uncached_list_flush_dev().
>
> One of the refcount underflow bugs is shown below:
> (cpu 1) | (cpu 2)
> xfrm6_dst_destroy() |
> ... |
> in6_dev_put() |
> | rt6_uncached_list_flush_dev()
> ... | ...
> | in6_dev_put()
> rt6_uncached_list_del() | ...
> ... |
>
> xfrm6_dst_destroy() calls rt6_uncached_list_del() after in6_dev_put(),
> so rt6_uncached_list_flush_dev() has a chance to call in6_dev_put()
> again for the same inet6_dev.
>
> Fix it by moving in6_dev_put() after rt6_uncached_list_del() in
> xfrm6_dst_destroy().
>
> Fixes: 510c321b5571 ("xfrm: reuse uncached_list to track xdsts")
> Signed-off-by: Zhang Changzhong <zhangchangzhong@...wei.com>
Applied, thanks a lot!
Powered by blists - more mailing lists