From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 102E43ACEED; Thu, 2 Jul 2026 16:41:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783010508; cv=none; b=QV1iaqlM63XOX0fBziJpCcq6hGouRCOyvYsJq/IYDAlikgtn5OIg98DptM1cnr0/5FCNuh3X7HPk94bC4t/ojVQuXTP89jLgijngf4N3Cm4bhqeqCpyMxbFK/ZaH3CATLc0qbFietWiB2qwuMFgDfUFlo9ZsAGcPHXldF/uo+mM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783010508; c=relaxed/simple; bh=rCphqvHkWS/B91rXfnmbfqmfGEpY1mqQppvn0qddSAk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GkWiCkvouWvtd5enc94V76MY0Z35tLQ2IiIIFNj9fO7eX9p6I6UWMIxmszjbugq2+5gLlX5yF7O5lKDw7GOjn6TJ9jEQCsXrtrwwjEVmpFof7mkZLnd5l1ZzNqgNx7bs2LiP9tPvlVW460Yyqdxxa9jZRy55p9SrMENQ/VrbMcg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=V4gD8Z3a; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="V4gD8Z3a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74DA91F00A3E; Thu, 2 Jul 2026 16:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1783010501; bh=kL0CczHoWIuh6ZJGiS5v2S6JWGlkvraPt2vPw5D/6Vg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=V4gD8Z3asnt2K34BVfrKJkPIwim8kqz966yjnA/btx2/tMt0OZ0LC98/8N7vBKNeg pwNNA9MKhOk5cIWEGUD76tjpWScfXngtMDNW1TfVMNJuGhngn0qEPZkxv+P/pcFzYZ DSNUzpBE9W2Knwvvx3719uw04GfakE/aLHbA8ZiU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Igor Ushakov , Kuniyuki Iwashima , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 133/204] af_unix: Set gc_in_progress to true in unix_gc(). Date: Thu, 2 Jul 2026 18:19:50 +0200 Message-ID: <20260702155121.447678691@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260702155118.667618796@linuxfoundation.org> References: <20260702155118.667618796@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kuniyuki Iwashima [ Upstream commit d82ba05263c69fa2437fe93e4e561cc40f4c03af ] Igor Ushakov reported that unix_gc() could run with gc_in_progress being false if the work is scheduled while running: Thread 1 Thread 2 Thread 3 -------- -------- -------- unix_schedule_gc() unix_schedule_gc() `- if (!gc_in_progress) `- if (!gc_in_progress) |- gc_in_progress = true | `- queue_work() | unix_gc() <----------------/ | | |- gc_in_progress = true ... `- queue_work() | | `- gc_in_progress = false | | unix_gc() <---------------------------------------------' | ... /* gc_in_progress == false */ | `- gc_in_progress = false unix_peek_fpl() relies on gc_in_progress not to confuse GC by MSG_PEEK. Let's set gc_in_progress to true in unix_gc(). Fixes: 8b90a9f819dc ("af_unix: Run GC on only one CPU.") Reported-by: Igor Ushakov Signed-off-by: Kuniyuki Iwashima Link: https://patch.msgid.link/20260501073945.1884564-1-kuniyu@google.com Signed-off-by: Jakub Kicinski [ Add setting gc_in_progress in __unix_gc(). Keep the existing set in unix_gc() for wait_for_unix_gc() over-limit throttling. ] Signed-off-by: Igor Ushakov Signed-off-by: Sasha Levin --- net/unix/garbage.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 1cdb54c61619f5..fa6983dc3181d9 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -583,6 +583,8 @@ static void __unix_gc(struct work_struct *work) struct sk_buff_head hitlist; struct sk_buff *skb; + WRITE_ONCE(gc_in_progress, true); + spin_lock(&unix_gc_lock); if (!unix_graph_maybe_cyclic) { -- 2.53.0