net/tls: don't arm strparser immediately in tls_set_sw_offload()
In tls_set_device_offload_rx() we prepare the software context for RX fallback and proceed to add the connection to the device. Unfortunately, software context prep includes arming strparser so in case of a later error we have to release the socket lock to call strp_done(). In preparation for not releasing the socket lock half way through callbacks move arming strparser into a separate function. Following patches will make use of that. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:

committed by
Daniel Borkmann

parent
1d4126c4e1
commit
318892ac06
@@ -526,6 +526,8 @@ static int do_tls_setsockopt_conf(struct sock *sk, char __user *optval,
|
||||
{
|
||||
#endif
|
||||
rc = tls_set_sw_offload(sk, ctx, 1);
|
||||
if (rc)
|
||||
goto err_crypto_info;
|
||||
conf = TLS_SW;
|
||||
}
|
||||
} else {
|
||||
@@ -537,13 +539,13 @@ static int do_tls_setsockopt_conf(struct sock *sk, char __user *optval,
|
||||
{
|
||||
#endif
|
||||
rc = tls_set_sw_offload(sk, ctx, 0);
|
||||
if (rc)
|
||||
goto err_crypto_info;
|
||||
tls_sw_strparser_arm(sk, ctx);
|
||||
conf = TLS_SW;
|
||||
}
|
||||
}
|
||||
|
||||
if (rc)
|
||||
goto err_crypto_info;
|
||||
|
||||
if (tx)
|
||||
ctx->tx_conf = conf;
|
||||
else
|
||||
|
Reference in New Issue
Block a user