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 BE9B83CB54B; Thu, 17 Sep 2026 17:12:00 +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=1789665122; cv=none; b=ry/nq0rBqcmYK9Aa00ig48smdPecPJwuZOuGG/Wf03WUrO88sXGR2gx5JEl33lnxWj3RZE4rAPLdcny6O7Tc4ira6jiefWz88ouxQgslHkAh4Di+JdpZ6bf7S+17EDxmxZkwYh9ZTX0+m5GunPFPqtkfxwa9u6Hv6H/OSgVo8gY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789665122; c=relaxed/simple; bh=o8uBQzk9wPZWIvDC7UQnH1Wh7Su1IOj9NCRc47PPyK4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DeUoPlaA5xEBQPGhvoBWN62X1IlWSLtomuhy7hJys4hYatxztle9xF1f+eA2jAhztegdqri187zhrx6kZZuUOusKfpyLk6dGDceB/QaZ4l/0jelYTgHdfcnrTQrZueRsbrFGv9CcSX/Q7bArHTCBYShXzKErp8IfMe8nrUK4IyI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wuvBaUHA; 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="wuvBaUHA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C0501F000FF; Thu, 17 Sep 2026 17:11:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789665120; bh=qhr93lpOSxgqTi3I8J/dNVKCKBzaRcVw3JypnRM2fnY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wuvBaUHA4qeOvA4rUfVbtBgEfFFfX1R0xuD2FsMBdQR0fZwr2rkHo5+z/M3o8DR6H kM6aMZxZXzkdOq4t46kC80ONxVQEYoqe78buVsWmwSOlUENJGtBtBa+xHjqBo44n+6 Hx/NhrA4j1IMvC7X4zJmg8Q+YJScnhj2KWpLP70w= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kyle Zeng , Kuniyuki Iwashima , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 0597/1250] af_unix: Unlink scc_entry in unix_del_edge(). Date: Thu, 17 Sep 2026 16:06:32 +0100 Message-ID: <20260917151608.062276309@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917151551.901433442@linuxfoundation.org> References: <20260917151551.901433442@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kuniyuki Iwashima [ Upstream commit 594d905195024b228c962627ae5ae7c17bd582a4 ] Kyle Zeng reported that GC could free a dead SCC partially. The scenario is as follows: 1) Create two SCCs: X -. A <-> B ^--' 2) Run the following concurrently: 2-1) send() sk-B to sk-B from sk-X 2-2) close() both A and B At 2-1), there is a small window where unix_add_edges() publishes a new edge (B <-> B) to GC but its skb is not queued by skb_queue_tail(). If 2-2) completes before skb_queue_tail() and GC is triggered, it judges A <-> B as dead, but B is not freed because GC cannot collect the not-yet-queued skb holding the B <-> B edge. X -. A <-> B -. This edge is visible ^--' ^..' but skb is not This itself is not a problem since the next GC run will judge B as dead as well and free it finally. X -. A <.> B -. ^--' ^--' However, X's SCC forces the next GC to call unix_walk_scc_fast(), and it iterates over A through B's scc_entry. Let's unlink scc_entry before freeing the vertex in unix_del_edge(). Fixes: 4090fa373f0e ("af_unix: Replace garbage collection algorithm.") Reported-by: Kyle Zeng Signed-off-by: Kuniyuki Iwashima Reviewed-by: Kyle Zeng Fixes: 4090fa373f0e ("af_unix: Replace garbage collection algorithm."). Link: https://patch.msgid.link/20260804002155.2233594-1-kuniyu@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/unix/garbage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 3986717090266..cad17f639b01b 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -186,6 +186,7 @@ static void unix_del_edge(struct scm_fp_list *fpl, struct unix_edge *edge) if (!vertex->out_degree) { edge->predecessor->vertex = NULL; list_move_tail(&vertex->entry, &fpl->vertices); + list_del(&vertex->scc_entry); } } -- 2.53.0