]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jun 2019 10:19:14 +0000 (12:19 +0200)
commit9749d62bda159db5e360f3d3e2e0825dba0dad9b
tree3102e7a3941728fbe69fe60daa7e64ee117512d8
parente246505558d6d987aba2eead3b1e54f2b7b163f3
net/tls: replace the sleeping lock around RX resync with a bit lock

[ Upstream commit e52972c11d6b1262964db96d65934196db621685 ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/net/tls.h
net/tls/tls_device.c