net/tls: replace the sleeping lock around RX resync with a bit lock
authorJakub Kicinski <jakub.kicinski@netronome.com>
Tue, 4 Jun 2019 19:00:12 +0000 (12:00 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Jun 2019 20:34:37 +0000 (13:34 -0700)
commite52972c11d6b1262964db96d65934196db621685
treeb082376e72b7935d16315fa9e1e9620fc8bca38b
parent27393f8c6efc03b8e0b64134721b0d337fca0a80
net/tls: replace the sleeping lock around RX resync with a bit lock

Commit 38030d7cb779 ("net/tls: avoid NULL-deref on resync during device removal")
tried to fix a potential NULL-dereference by taking the
context rwsem.  Unfortunately the RX resync may get called
from soft IRQ, so we can't use the rwsem to protect from
the device disappearing.  Because we are guaranteed there
can be only one resync at a time (it's called from strparser)
use a bit to indicate resync is busy and make device
removal wait for the bit to get cleared.

Note that there is a leftover "flags" field in struct
tls_context already.

Fixes: 4799ac81e52a ("tls: Add rx inline crypto offload")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tls.h
net/tls/tls_device.c