Software fallback output still belongs to the offloaded socket. A driver that checks only the socket can therefore encrypt ciphertext again, exposing plaintext. Require skb_is_decrypted() in tls_is_skb_tx_device_offloaded(). Fallback output then takes the ordinary TX path, as does data queued before TLS_TX was enabled. Backport the first three fixes together, in order. Found by manual inspection. On two mlx5 hosts with TLS 1.2 AES-GCM-128, the macvlan reroute test returned a mismatched echo without the fix and passed with it. The other drivers were checked by inspection only. Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure") Cc: stable@vger.kernel.org Signed-off-by: Rishikesh Jethwani --- include/net/tls.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/net/tls.h b/include/net/tls.h index 0b001b8ab1c3..9998b5582091 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -365,7 +365,8 @@ static inline bool tls_is_skb_tx_device_offloaded(const struct sk_buff *skb) return sk && sk_fullsock(sk) && (smp_load_acquire(&sk->sk_validate_xmit_skb) == - &tls_validate_xmit_skb); + &tls_validate_xmit_skb) && + skb_is_decrypted(skb); #else return false; #endif -- 2.50.1