diff options
author | Maxim Mikityanskiy <maximmi@mellanox.com> | 2020-11-26 01:18:10 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-12-08 12:18:52 +0300 |
commit | 2ba413da624ee45b29cc9de5fff710c19c4efcde (patch) | |
tree | 5a205e4b7ba9cf57e20cc5dc3377bd6a14433d48 /include/net | |
parent | 39553ecdea4743da7b6ce9096ae0a831fe881f75 (diff) | |
download | linux-2ba413da624ee45b29cc9de5fff710c19c4efcde.tar.xz |
net/tls: Protect from calling tls_dev_del for TLS RX twice
[ Upstream commit 025cc2fb6a4e84e9a0552c0017dcd1c24b7ac7da ]
tls_device_offload_cleanup_rx doesn't clear tls_ctx->netdev after
calling tls_dev_del if TLX TX offload is also enabled. Clearing
tls_ctx->netdev gets postponed until tls_device_gc_task. It leaves a
time frame when tls_device_down may get called and call tls_dev_del for
RX one extra time, confusing the driver, which may lead to a crash.
This patch corrects this racy behavior by adding a flag to prevent
tls_device_down from calling tls_dev_del the second time.
Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure")
Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Link: https://lore.kernel.org/r/20201125221810.69870-1-saeedm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/tls.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/net/tls.h b/include/net/tls.h index 98f5ad0319a2..9caef9bad075 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -163,6 +163,12 @@ enum { enum tls_context_flags { TLS_RX_SYNC_RUNNING = 0, + /* tls_dev_del was called for the RX side, device state was released, + * but tls_ctx->netdev might still be kept, because TX-side driver + * resources might not be released yet. Used to prevent the second + * tls_dev_del call in tls_device_down if it happens simultaneously. + */ + TLS_RX_DEV_CLOSED = 2, }; struct cipher_context { |