From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F0153CFCEB; Sat, 28 Feb 2026 17:40:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300416; cv=none; b=YdDU/E3CNi/qp5tB7Q12c28JmD4E7fS0z9V6GeleBrnFeeWNi+6YN6L1E7ImFFeH/Y5XTQ6coZlHAc3FnEmKar7fkYRI0FWGuMQgJVBkwJ2OAjurvUU2+gtDk5O5yrfK/+GcUafz6Q8l21r4mDBvsYcCrE29Q0sZclitNeXkdxU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300416; c=relaxed/simple; bh=dH/i1FBsguOEmUILzyVjTdcuHv2E7eXf4aeX/spdWmg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m57M92kHJPWk5H0GeafvyIr8Lojr0kz+gwOGRkWB9subFx+BtHSL2B3TpNqntLDXs9mqb3No6zYyGpGKqk8kOcj3gB/XTUB6pztbYvjbMepS7PPcwil6gX+6Ypp6Popkf3QQ4XzS6M27BZS5CHEmAp0CMPz+L9tGXkL5IkZfQNQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=T6j1we1l; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="T6j1we1l" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D45DDC116D0; Sat, 28 Feb 2026 17:40:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772300416; bh=dH/i1FBsguOEmUILzyVjTdcuHv2E7eXf4aeX/spdWmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T6j1we1l3Yhp/wKBsoYQjfTTHs06Q+FILcL0Tb/X2nsAs9iWFZ7WAvDUaMJ3Pso5j PWibYPGCCKZ9FiHqq8kbDSFliLK1rXnCxzsZFY5b2Q+ko3YgEUE89gN2xs0mcbWsjT U7Q09Ugf3GqmRgQk56+eBekvMdPTkgMvmtdSSTUKgPqP/Q8HKhflVUgxMGGv63FCx6 glEFMtutZMAd9jkfdYJkGKlwv7SVer/vKrQecDwKrgbZFOUhtsdrtG1c4QYGmQ4Elm uCzuRvJVQfpsFIxclP/jUGEL4WABvId4wu1vYRQjHKJGE0Sx3FgYwqSvc+BuK5OQ4k pdjFfBk9XhgPg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hyunwoo Kim , Simon Horman , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.19 454/844] espintcp: Fix race condition in espintcp_close() Date: Sat, 28 Feb 2026 12:26:07 -0500 Message-ID: <20260228173244.1509663-455-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260228173244.1509663-1-sashal@kernel.org> References: <20260228173244.1509663-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Hyunwoo Kim [ Upstream commit e1512c1db9e8794d8d130addd2615ec27231d994 ] This issue was discovered during a code audit. 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. The following is a simple race scenario: cpu0 cpu1 espintcp_close() cancel_work_sync(&ctx->work); espintcp_write_space() schedule_work(&ctx->work); 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 Reviewed-by: Simon Horman Link: https://patch.msgid.link/aZSie7rEdh9Nu0eM@v4bel Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/xfrm/espintcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/xfrm/espintcp.c b/net/xfrm/espintcp.c index bf744ac9d5a73..8709df716e98e 100644 --- a/net/xfrm/espintcp.c +++ b/net/xfrm/espintcp.c @@ -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); -- 2.51.0