]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit1df6904a57472c849ca17a64e63282e73bb891bc
treeb082376e72b7935d16315fa9e1e9620fc8bca38b
parent7c696b0dff545c555199c06ea4d198e77c680517
net/tls: replace the sleeping lock around RX resync with a bit lock

Commit 48bf54da97df ("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: 81b6ef1732a9 ("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