Revert "af_unix: Fix garbage collector racing against connect()"

This reverts commit 6487f3d346.

Reason for revert: Conflicts with upstream commits.

Change-Id: I5e1ccd8f68283fe88f90eebc33ade79fddf0054a
This commit is contained in:
Michael Bestas 2025-03-19 07:33:06 +02:00
commit 3628064f37
No known key found for this signature in database

View file

@ -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);
}
}
}