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 C116532ED40; Thu, 2 Jul 2026 16:50:07 +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=1783011008; cv=none; b=FLN9/zXnIpeuRVaqfPpgkYO4Eg1jJm+lfjTOPZp07ZelQkTLOIjDo7PIZj7kjk91rBCyeuNNp+hraIttM5uX74v3Hp9RGtFLDm7dkPQULULxNTD2lV+2qDxMIUsavFFNwMTjPQ2F0K2JgzEpIHhlMXHWJmSV3rHSn7G8jKre/YA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783011008; c=relaxed/simple; bh=M1i2Err9otXt4cawRqlEof2mnPeRqUCv9bPE9jh+/j0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K+4m1aoyAJ3KjdtRln4a1bPebqYrQMfaPqKLWThwfxAwBVq6rNPKW39OK7cC8nFtsZJHggGDJH8kdUHQj64mgFyV+h3QRlXT64cFBD404aFf9CLOQUtCkFxZ7uo8FuTnmU/ggg5Tdat2+hYInnh/uYteZViuvWucJoG2MB5i01k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=RsUrWCHO; 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="RsUrWCHO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3383B1F000E9; Thu, 2 Jul 2026 16:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1783011007; bh=KBPDtE1vh+2yY6HEwoZEy2pAkXNRRgSNTN7W8WqcOko=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RsUrWCHO31RhHsxeUeabicBwzYsteXBMJWCL0Yfw9qmGMMNflXhSm4FJke09TH9He G3K3y/XkCUPHh53qg8p7ueDbcvXzvn7L74b6rMogm9ikDfWypslvIEgTSRR8pmuoo+ Y4DxEa8WdWylemumn+MdXKof1NGPp68I68OrjoH4= 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.6 121/175] af_unix: Set gc_in_progress to true in unix_gc(). Date: Thu, 2 Jul 2026 18:20:22 +0200 Message-ID: <20260702155118.302440209@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260702155115.766838875@linuxfoundation.org> References: <20260702155115.766838875@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.6-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