]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
af_unix: Annotate data-race of gc_in_progress in wait_for_unix_gc().
authorKuniyuki Iwashima <kuniyu@amazon.com>
Tue, 23 Jan 2024 17:08:52 +0000 (09:08 -0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 27 Jan 2024 04:34:24 +0000 (20:34 -0800)
gc_in_progress is changed under spin_lock(&unix_gc_lock),
but wait_for_unix_gc() reads it locklessly.

Let's use READ_ONCE().

Fixes: 5f23b734963e ("net: Fix soft lockups/OOM issues w/ unix garbage collector")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20240123170856.41348-2-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/unix/garbage.c

index 2405f0f9af31c0ccefe2aa404002cfab8583c090..af3d2221cf6ad36cf60da421936b7ae658d55d6d 100644 (file)
@@ -198,7 +198,7 @@ void wait_for_unix_gc(void)
        if (READ_ONCE(unix_tot_inflight) > UNIX_INFLIGHT_TRIGGER_GC &&
            !READ_ONCE(gc_in_progress))
                unix_gc();
-       wait_event(unix_gc_wait, gc_in_progress == false);
+       wait_event(unix_gc_wait, !READ_ONCE(gc_in_progress));
 }
 
 /* The external entry point: unix_gc() */