Skip to content

Commit 8428d1d

Browse files
author
Sabrina Dubroca
committed
net/tls: fix kernel panic when alloc_page failed
JIRA: https://issues.redhat.com/browse/RHEL-115640 commit 491deb9 Author: Pengtao He <hept.hept.hept@gmail.com> Date: Wed May 14 21:20:13 2025 +0800 net/tls: fix kernel panic when alloc_page failed We cannot set frag_list to NULL pointer when alloc_page failed. It will be used in tls_strp_check_queue_ok when the next time tls_strp_read_sock is called. This is because we don't reset full_len in tls_strp_flush_anchor_copy() so the recv path will try to continue handling the partial record on the next call but we dettached the rcvq from the frag list. Alternative fix would be to reset full_len. Unable to handle kernel NULL pointer dereference at virtual address 0000000000000028 Call trace: tls_strp_check_rcv+0x128/0x27c tls_strp_data_ready+0x34/0x44 tls_data_ready+0x3c/0x1f0 tcp_data_ready+0x9c/0xe4 tcp_data_queue+0xf6c/0x12d0 tcp_rcv_established+0x52c/0x798 Fixes: 84c61fe ("tls: rx: do not use the standard strparser") Signed-off-by: Pengtao He <hept.hept.hept@gmail.com> Link: https://patch.msgid.link/20250514132013.17274-1-hept.hept.hept@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sabrina Dubroca <sdubroca@redhat.com>
1 parent f91d77e commit 8428d1d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/tls/tls_strp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ static int tls_strp_read_copy(struct tls_strparser *strp, bool qshort)
395395
return 0;
396396

397397
shinfo = skb_shinfo(strp->anchor);
398-
shinfo->frag_list = NULL;
399398

400399
/* If we don't know the length go max plus page for cipher overhead */
401400
need_spc = strp->stm.full_len ?: TLS_MAX_PAYLOAD_SIZE + PAGE_SIZE;
@@ -411,6 +410,8 @@ static int tls_strp_read_copy(struct tls_strparser *strp, bool qshort)
411410
page, 0, 0);
412411
}
413412

413+
shinfo->frag_list = NULL;
414+
414415
strp->copy_mode = 1;
415416
strp->stm.offset = 0;
416417

0 commit comments

Comments
 (0)