Skip to contentSkip to conversation

tls: rx: react to strparser initialization errors

PATCH Applied Jakub Kicinski 2 participants 2 messages Aug 16, 2022 – Aug 17, 2022

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 tls: rx: react to strparser initialization errors

Even though the normal strparser's init function has a return value we got away with ignoring errors until now, as it only validates the parameters and we were passing correct parameters.

tls_strp can fail to init on memory allocation errors, which syzbot duly induced and reported.

Reported-by [email protected]
Fixes 84c61fe1a75b ("tls: rx: do not use the standard strparser")

---
CC: [email protected]
CC: [email protected]

---
 net/tls/tls_sw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/tls/tls_sw.c +3 -1
index f76119f62f1b..fe27241cd13f 100644
@@ -2702,7 +2702,9 @@ int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx)
 			crypto_info->version != TLS_1_3_VERSION &&
 			!!(tfm->__crt_alg->cra_flags & CRYPTO_ALG_ASYNC);
 
-		tls_strp_init(&sw_ctx_rx->strp, sk);
+		rc = tls_strp_init(&sw_ctx_rx->strp, sk);
+		if (rc)
+			goto free_aead;
 	}
 
 	goto out;
Signature · 1 line
2.37.2
#1 lore raw
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 8 lines · On Mon, 15 Aug 2022 17:23:58 -0700 you wrote:

Even though the normal strparser's init function has a return value we got away with ignoring errors until now, as it only validates the parameters and we were passing correct parameters.

tls_strp can fail to init on memory allocation errors, which syzbot duly induced and reported.

[...]

Here is the summary with links:
- [net] tls: rx: react to strparser initialization errors

    https://git.kernel.org/netdev/net/c/849f16bbfb68

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html