espintcp: Use disable_work_sync() instead of cancel_work_sync() in espintcp_close()
Subsystems (3)
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)")
Signed-off-by Hyunwoo Kim <[email protected]>
--- net/xfrm/espintcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/espintcp.c +1 -1
@@ -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