On Fri, 28 Jun 2019 07:12:07 -0700, John Fastabend wrote: > Yeah seems possible although never seen in my testing. So I'll > move the test_bit() inside the lock and do a ctx check to ensure > still have the reference. > > CPU 0 (free) CPU 1 (wq) > > lock(sk) > lock(sk) > set_bit() > cancel_work() > release > ctx = tls_get_ctx(sk) > unlikely(!ctx) <- we may have free'd > test_bit() > ... > release() > > or > > CPU 0 (free) CPU 1 (wq) > > lock(sk) > lock(sk) > ctx = tls_get_ctx(sk) > unlikely(!ctx) > test_bit() > ... > release() > set_bit() > cancel_work() > release Hmm... perhaps it's cleanest to stop the work from scheduling before we proceed? close(): while (!test_and_set(SHED)) flush(); lock(sk); ... We just need to move init work, no? FWIW I never tested his async crypto stuff, I wonder if there is a way to convince normal CPU crypto to pretend to be async?