Skip to content

Commit 74836ec

Browse files
kuba-moodavem330
authored andcommitted
tls: rx: strp: don't use GFP_KERNEL in softirq context
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: 84c61fe ("tls: rx: do not use the standard strparser") Tested-by: Shai Amiram <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent eca9bfa commit 74836ec

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/tls/tls_sw.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,10 +2304,14 @@ static void tls_data_ready(struct sock *sk)
23042304
struct tls_context *tls_ctx = tls_get_ctx(sk);
23052305
struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx);
23062306
struct sk_psock *psock;
2307+
gfp_t alloc_save;
23072308

23082309
trace_sk_data_ready(sk);
23092310

2311+
alloc_save = sk->sk_allocation;
2312+
sk->sk_allocation = GFP_ATOMIC;
23102313
tls_strp_data_ready(&ctx->strp);
2314+
sk->sk_allocation = alloc_save;
23112315

23122316
psock = sk_psock_get(sk);
23132317
if (psock) {

0 commit comments

Comments
 (0)