From 3628064f37559b7aafd94f47aba88bc0ad5f17e1 Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Wed, 19 Mar 2025 07:33:06 +0200 Subject: [PATCH] Revert "af_unix: Fix garbage collector racing against connect()" This reverts commit 6487f3d3468b5df030838ad7dc02d63ab99d81eb. Reason for revert: Conflicts with upstream commits. Change-Id: I5e1ccd8f68283fe88f90eebc33ade79fddf0054a --- net/unix/garbage.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 67b2c3bfa113..312474c23e9a 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -235,22 +235,11 @@ void unix_gc(void) * receive queues. Other, non candidate sockets _can_ be * added to queue, so we must make sure only to touch * candidates. - * - * Embryos, though never candidates themselves, affect which - * candidates are reachable by the garbage collector. Before - * being added to a listener's queue, an embryo may already - * receive data carrying SCM_RIGHTS, potentially making the - * passed socket a candidate that is not yet reachable by the - * collector. It becomes reachable once the embryo is - * enqueued. Therefore, we must ensure that no SCM-laden - * embryo appears in a (candidate) listener's queue between - * consecutive scan_children() calls. */ list_for_each_entry_safe(u, next, &gc_inflight_list, link) { - struct sock *sk = &u->sk; long total_refs; - total_refs = file_count(sk->sk_socket->file); + total_refs = file_count(u->sk.sk_socket->file); BUG_ON(!u->inflight); BUG_ON(total_refs < u->inflight); @@ -258,11 +247,6 @@ void unix_gc(void) list_move_tail(&u->link, &gc_candidates); __set_bit(UNIX_GC_CANDIDATE, &u->gc_flags); __set_bit(UNIX_GC_MAYBE_CYCLE, &u->gc_flags); - - if (sk->sk_state == TCP_LISTEN) { - unix_state_lock(sk); - unix_state_unlock(sk); - } } }