diff options
author | David S. Miller | 2019-06-19 17:37:48 +0200 |
---|---|---|
committer | David S. Miller | 2019-06-19 17:37:48 +0200 |
commit | 6c9bef32c6e742e847fc28c9bf7721cbfa003fa6 (patch) | |
tree | f792af2a9bea74e3af00424f26f41087916abef9 /net/ipv4/inet_fragment.c | |
parent | Merge branch 'xdp-page_pool-fixes-and-in-flight-accounting' (diff) | |
parent | inet: fix various use-after-free in defrags units (diff) | |
download | kernel-qcow2-linux-6c9bef32c6e742e847fc28c9bf7721cbfa003fa6.tar.gz kernel-qcow2-linux-6c9bef32c6e742e847fc28c9bf7721cbfa003fa6.tar.xz kernel-qcow2-linux-6c9bef32c6e742e847fc28c9bf7721cbfa003fa6.zip |
Merge branch 'inet-fix-defrag-units-dismantle-races'
Eric Dumazet says:
====================
inet: fix defrag units dismantle races
This series add a new pre_exit() method to struct pernet_operations
to solve a race in defrag units dismantle, without adding extra
delays to netns dismantles.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_fragment.c')
-rw-r--r-- | net/ipv4/inet_fragment.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c index 5c25727d491e..d666756be5f1 100644 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c @@ -145,10 +145,9 @@ static void inet_frags_free_cb(void *ptr, void *arg) inet_frag_destroy(fq); } -static void fqdir_rwork_fn(struct work_struct *work) +static void fqdir_work_fn(struct work_struct *work) { - struct fqdir *fqdir = container_of(to_rcu_work(work), - struct fqdir, destroy_rwork); + struct fqdir *fqdir = container_of(work, struct fqdir, destroy_work); struct inet_frags *f = fqdir->f; rhashtable_free_and_destroy(&fqdir->rhashtable, inet_frags_free_cb, NULL); @@ -187,18 +186,8 @@ EXPORT_SYMBOL(fqdir_init); void fqdir_exit(struct fqdir *fqdir) { - fqdir->high_thresh = 0; /* prevent creation of new frags */ - - fqdir->dead = true; - - /* call_rcu is supposed to provide memory barrier semantics, - * separating the setting of fqdir->dead with the destruction - * work. This implicit barrier is paired with inet_frag_kill(). - */ - - INIT_RCU_WORK(&fqdir->destroy_rwork, fqdir_rwork_fn); - queue_rcu_work(system_wq, &fqdir->destroy_rwork); - + INIT_WORK(&fqdir->destroy_work, fqdir_work_fn); + queue_work(system_wq, &fqdir->destroy_work); } EXPORT_SYMBOL(fqdir_exit); |