]> git.baikalelectronics.ru Git - kernel.git/commit
net: Fix hlist corruptions in inet_evict_bucket()
authorKirill Tkhai <ktkhai@virtuozzo.com>
Tue, 6 Mar 2018 15:46:39 +0000 (18:46 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 7 Mar 2018 18:29:28 +0000 (13:29 -0500)
commit5c7de6c2585e9099408a96a004eaed9def4cade9
tree7ab982974c8eef6262d722034ead8a4011f9bcda
parent378d83aec48d656ff87c98aa6d7ca3de2c4f0f7a
net: Fix hlist corruptions in inet_evict_bucket()

inet_evict_bucket() iterates global list, and
several tasks may call it in parallel. All of
them hash the same fq->list_evictor to different
lists, which leads to list corruption.

This patch makes fq be hashed to expired list
only if this has not been made yet by another
task. Since inet_frag_alloc() allocates fq
using kmem_cache_zalloc(), we may rely on
list_evictor is initially unhashed.

The problem seems to exist before async
pernet_operations, as there was possible to have
exit method to be executed in parallel with
inet_frags::frags_work, so I add two Fixes tags.
This also may go to stable.

Fixes: ae33289f0705 "inet: frag: don't re-use chainlist for evictor"
Fixes: f84c6821aa54 "net: Convert pernet_subsys, registered from inet_init()"
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/inet_fragment.c