Skip to contentSkip to conversation

Add missing NULL check in `tls_strp_check_queue_ok`

RFC PATCH In review Frederik Deweerdt 2 participants 5 messages Oct 30, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Add missing NULL check in `tls_strp_check_queue_ok`

Hi!

We see tls_strp_check_queue_ok running into a NULL deref when evaluating TCP_SKB_CB(skb)->seq.

This commit attempts to address the issue by exiting the loop if skb->next is NULL, and has proven stable under load.

That said i don't understand the code enough to convince myself that the NULL check is indeed required, and i would be happy gather data if that's useful.

---
 net/tls/tls_strp.c | 2 ++
 1 file changed, 2 insertions(+)
net/tls/tls_strp.c +2 -0
index ca1e0e198ceb..cabac0db6445 100644
@@ -441,6 +441,8 @@ static bool tls_strp_check_queue_ok(struct tls_strparser *strp)
 		len -= skb->len;
 		skb = skb->next;
 
+		if (!skb)
+			return false;
 		if (TCP_SKB_CB(skb)->seq != seq)
 			return false;
 		if (skb_cmp_decrypted(first, skb))
Signature · 1 line
2.42.0
maintainer
#1 lore raw
Quoted 9 lines · On Mon, 30 Oct 2023 14:57:29 -0700 Frederik Deweerdt wrote:

We see tls_strp_check_queue_ok running into a NULL deref when evaluating TCP_SKB_CB(skb)->seq.

This commit attempts to address the issue by exiting the loop if skb->next is NULL, and has proven stable under load.

That said i don't understand the code enough to convince myself that the NULL check is indeed required, and i would be happy gather data if that's useful.

Hm. Can you share the decoded stack trace?

#2 lore raw
Quoted 4 lines · Jakub Kicinski
Quoted 3 lines · On Mon, 30 Oct 2023 14:57:29 -0700 Frederik Deweerdt wrote:

We see tls_strp_check_queue_ok running into a NULL deref when evaluating TCP_SKB_CB(skb)->seq.

Quoted 8 lines
Quoted 6 lines

This commit attempts to address the issue by exiting the loop if skb->next is NULL, and has proven stable under load.

That said i don't understand the code enough to convince myself that the NULL check is indeed required, and i would be happy gather data if that's useful.

Hm. Can you share the decoded stack trace?

We could only have screen captures from the management console. I've attached the image to this email.

Frederik

maintainer
#3 lore raw
Quoted 4 lines · On Mon, 30 Oct 2023 15:20:05 -0700 Frederik Deweerdt wrote:
Quoted 1 line

Hm. Can you share the decoded stack trace?

We could only have screen captures from the management console. I've attached the image to this email.

Is it possible to enable crash dump kernel or serial console or netconsole on the machines to catch a fuller stack trace?

#4 lore raw
Quoted 8 lines · Jakub Kicinski
Quoted 4 lines · On Mon, 30 Oct 2023 15:20:05 -0700 Frederik Deweerdt wrote:
Quoted 1 line

Hm. Can you share the decoded stack trace?

We could only have screen captures from the management console. I've attached the image to this email.

Is it possible to enable crash dump kernel or serial console or netconsole on the machines to catch a fuller stack trace?

It might me, let me ask internally.

Thanks!
Frederik