]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
af_unix: Replace BUG_ON() with WARN_ON_ONCE().
authorKuniyuki Iwashima <kuniyu@amazon.com>
Wed, 21 May 2025 15:27:04 +0000 (16:27 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:40:23 +0000 (14:40 +0200)
commit d0f6dc26346863e1f4a23117f5468614e54df064 upstream.

This is a prep patch for the last patch in this series so that
checkpatch will not warn about BUG_ON().

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20240129190435.57228-2-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/unix/garbage.c
net/unix/scm.c

index 2934d7b6803620107b8f6f811e3a0f88be7faf82..7eeaac165e858272fddc601fe56c80fca243d3e8 100644 (file)
@@ -145,7 +145,7 @@ static void scan_children(struct sock *x, void (*func)(struct unix_sock *),
                        /* An embryo cannot be in-flight, so it's safe
                         * to use the list link.
                         */
-                       BUG_ON(!list_empty(&u->link));
+                       WARN_ON_ONCE(!list_empty(&u->link));
                        list_add_tail(&u->link, &embryos);
                }
                spin_unlock(&x->sk_receive_queue.lock);
@@ -224,8 +224,8 @@ static void __unix_gc(struct work_struct *work)
 
                total_refs = file_count(sk->sk_socket->file);
 
-               BUG_ON(!u->inflight);
-               BUG_ON(total_refs < u->inflight);
+               WARN_ON_ONCE(!u->inflight);
+               WARN_ON_ONCE(total_refs < u->inflight);
                if (total_refs == u->inflight) {
                        list_move_tail(&u->link, &gc_candidates);
                        __set_bit(UNIX_GC_CANDIDATE, &u->gc_flags);
@@ -318,7 +318,7 @@ static void __unix_gc(struct work_struct *work)
                list_move_tail(&u->link, &gc_inflight_list);
 
        /* All candidates should have been detached by now. */
-       BUG_ON(!list_empty(&gc_candidates));
+       WARN_ON_ONCE(!list_empty(&gc_candidates));
 
        /* Paired with READ_ONCE() in wait_for_unix_gc(). */
        WRITE_ONCE(gc_in_progress, false);
index 693817a31ad85e45a4cb805e4c2f09742aacaa35..6f446dd2deed59e803b89e194bd493d6802769c1 100644 (file)
@@ -50,10 +50,10 @@ void unix_inflight(struct user_struct *user, struct file *fp)
 
        if (u) {
                if (!u->inflight) {
-                       BUG_ON(!list_empty(&u->link));
+                       WARN_ON_ONCE(!list_empty(&u->link));
                        list_add_tail(&u->link, &gc_inflight_list);
                } else {
-                       BUG_ON(list_empty(&u->link));
+                       WARN_ON_ONCE(list_empty(&u->link));
                }
                u->inflight++;
                /* Paired with READ_ONCE() in wait_for_unix_gc() */
@@ -70,8 +70,8 @@ void unix_notinflight(struct user_struct *user, struct file *fp)
        spin_lock(&unix_gc_lock);
 
        if (u) {
-               BUG_ON(!u->inflight);
-               BUG_ON(list_empty(&u->link));
+               WARN_ON_ONCE(!u->inflight);
+               WARN_ON_ONCE(list_empty(&u->link));
 
                u->inflight--;
                if (!u->inflight)