diff options
author | Zhang Changzhong <zhangchangzhong@huawei.com> | 2023-09-15 19:20:41 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-10-25 11:17:03 +0200 |
commit | 0939d7817d5c0dc3900527a54d1cdec2e9f8fe78 (patch) | |
tree | 4fe0edb9ea94862c819b248562219b66d272dd9e /arch/mips/loongson64 | |
parent | 942cab53cc51b20dfb9f51172e10fb6fe1d3b19f (diff) | |
download | linux-stable-0939d7817d5c0dc3900527a54d1cdec2e9f8fe78.tar.gz linux-stable-0939d7817d5c0dc3900527a54d1cdec2e9f8fe78.tar.bz2 linux-stable-0939d7817d5c0dc3900527a54d1cdec2e9f8fe78.zip |
xfrm6: fix inet6_dev refcount underflow problem
[ Upstream commit cc9b364bb1d58d3dae270c7a931a8cc717dc2b3b ]
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@huawei.com>
Reviewed-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/mips/loongson64')
0 files changed, 0 insertions, 0 deletions