Skip to contentSkip to conversation

espintcp: Use disable_work_sync() instead of cancel_work_sync() in espintcp_close()

PATCH New Hyunwoo Kim 1 participant 1 message Feb 16

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

PATCH 1/1 espintcp: Use disable_work_sync() instead of cancel_work_sync() in espintcp_close()

After cancel_work_sync() is called from espintcp_close(), espintcp_tx_work() can still be scheduled from paths such as the Delayed ACK handler or ksoftirqd.
As a result, the espintcp_tx_work() worker may dereference a freed espintcp ctx or sk.

To prevent this race condition, cancel_work_sync() is replaced with disable_work_sync().

Fixes e27cca96cd68 ("xfrm: add espintcp (RFC 8229)")
---
 net/xfrm/espintcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/espintcp.c +1 -1
index bf744ac9d5a7..8709df716e98 100644
@@ -536,7 +536,7 @@ static void espintcp_close(struct sock *sk, long timeout)
 	sk->sk_prot = &tcp_prot;
 	barrier();
 
-	cancel_work_sync(&ctx->work);
+	disable_work_sync(&ctx->work);
 	strp_done(&ctx->strp);
 
 	skb_queue_purge(&ctx->out_queue);
Signature · 1 line
2.43.0