Skip to contentSkip to conversation

tls: rx: strp: don't use GFP_KERNEL in softirq context

PATCH In review Jakub Kicinski 2 participants 2 messages Jun 6, 2023 – Jun 7, 2023 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tls: rx: strp: don't use GFP_KERNEL in softirq context

[ Upstream commit 74836ec828fe17b63f2006fdbf53311d691396bf ]

When receive buffer is small, or the TCP rx queue looks too complicated to bother using it directly - we allocate a new skb and copy data into it.

We already use sk->sk_allocation... but nothing actually sets it to GFP_ATOMIC on the ->sk_data_ready() path.

Users of HW offload are far more likely to experience problems due to scheduling while atomic. "Copy mode" is very rarely triggered with SW crypto.

Fixes 84c61fe1a75b ("tls: rx: do not use the standard strparser")
---
 net/tls/tls_sw.c | 4 ++++
 1 file changed, 4 insertions(+)
net/tls/tls_sw.c +4 -0
index 992092aeebad..3a08cf1258b5 100644
@@ -2287,8 +2287,12 @@ static void tls_data_ready(struct sock *sk)
 	struct tls_context *tls_ctx = tls_get_ctx(sk);
 	struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx);
 	struct sk_psock *psock;
+	gfp_t alloc_save;
 
+	alloc_save = sk->sk_allocation;
+	sk->sk_allocation = GFP_ATOMIC;
 	tls_strp_data_ready(&ctx->strp);
+	sk->sk_allocation = alloc_save;
 
 	psock = sk_psock_get(sk);
 	if (psock) {
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 13 lines · Jakub Kicinski

[ Upstream commit 74836ec828fe17b63f2006fdbf53311d691396bf ]

When receive buffer is small, or the TCP rx queue looks too complicated to bother using it directly - we allocate a new skb and copy data into it.

We already use sk->sk_allocation... but nothing actually sets it to GFP_ATOMIC on the ->sk_data_ready() path.

Users of HW offload are far more likely to experience problems due to scheduling while atomic. "Copy mode" is very rarely triggered with SW crypto.

Quoted 9 lines
Fixes 84c61fe1a75b ("tls: rx: do not use the standard strparser")
---
 net/tls/tls_sw.c | 4 ++++
 1 file changed, 4 insertions(+)

Now queued up, thanks.

greg k-h