diff options
author | Kefeng Wang <[email protected]> | 2021-08-06 16:21:24 +0800 |
---|---|---|
committer | David S. Miller <[email protected]> | 2021-08-08 13:00:20 +0100 |
commit | 1027b96ec9d34f9abab69bc1a4dc5b1ad8ab1349 (patch) | |
tree | cd0aaca19f2c451ac22683a7bfd1d321b915f25d /tools/perf/scripts/python/export-to-postgresql.py | |
parent | d329e41a08f37c478159d5c3379a17b9c07befa3 (diff) |
once: Fix panic when module unload
DO_ONCE
DEFINE_STATIC_KEY_TRUE(___once_key);
__do_once_done
once_disable_jump(once_key);
INIT_WORK(&w->work, once_deferred);
struct once_work *w;
w->key = key;
schedule_work(&w->work); module unload
//*the key is
destroy*
process_one_work
once_deferred
BUG_ON(!static_key_enabled(work->key));
static_key_count((struct static_key *)x) //*access key, crash*
When module uses DO_ONCE mechanism, it could crash due to the above
concurrency problem, we could reproduce it with link[1].
Fix it by add/put module refcount in the once work process.
[1] https://lore.kernel.org/netdev/[email protected]/
Cc: Hannes Frederic Sowa <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Eric Dumazet <[email protected]>
Reported-by: Minmin chen <[email protected]>
Signed-off-by: Kefeng Wang <[email protected]>
Acked-by: Hannes Frederic Sowa <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions