mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+fa3ef895554bdbfd1183@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [net?] WARNING in __unix_gc
Date: Sat,  3 Feb 2024 08:41:22 +0800	[thread overview]
Message-ID: <20240203004122.1625-1-hdanton@sina.com> (raw)
In-Reply-To: <0000000000003555920610660fbc@google.com>

On Fri, 02 Feb 2024 05:26:28 -0800
> HEAD commit:    1701940b1a02 Merge branch 'tools-net-ynl-add-features-for-..
> git tree:       net-next
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12d6927be80000

#syz test 

--- x/net/unix/garbage.c
+++ y/net/unix/garbage.c
@@ -237,6 +237,8 @@ static void inc_inflight(struct unix_soc
 	usk->inflight++;
 }
 
+static int recycle;
+
 static void inc_inflight_move_tail(struct unix_sock *u)
 {
 	u->inflight++;
@@ -245,8 +247,10 @@ static void inc_inflight_move_tail(struc
 	 * of the list, so that it's checked even if it was already
 	 * passed over
 	 */
-	if (test_bit(UNIX_GC_MAYBE_CYCLE, &u->gc_flags))
+	if (test_bit(UNIX_GC_MAYBE_CYCLE, &u->gc_flags)) {
 		list_move_tail(&u->link, &gc_candidates);
+		recycle++;
+	}
 }
 
 static bool gc_in_progress;
@@ -259,6 +263,7 @@ static void __unix_gc(struct work_struct
 	struct list_head cursor;
 
 	spin_lock(&unix_gc_lock);
+	recycle = 0;
 
 	/* First, select candidates for garbage collection.  Only
 	 * in-flight sockets are considered, and from those only ones
@@ -342,7 +347,7 @@ static void __unix_gc(struct work_struct
 	spin_lock(&unix_gc_lock);
 
 	/* All candidates should have been detached by now. */
-	WARN_ON_ONCE(!list_empty(&gc_candidates));
+	WARN_ON_ONCE(!list_empty(&gc_candidates) && !recycle);
 
 	/* Paired with READ_ONCE() in wait_for_unix_gc(). */
 	WRITE_ONCE(gc_in_progress, false);
--

  reply	other threads:[~2024-02-03  0:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 13:26 syzbot
2024-02-03  0:41 ` Hillf Danton [this message]
2024-02-03  3:17   ` syzbot
2024-02-03  4:00 ` Kuniyuki Iwashima

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240203004122.1625-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+fa3ef895554bdbfd1183@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®