Message ID | 20240218190032.39987-1-kuniyu@amazon.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [syzbot,net?] INFO: task hung in unix_stream_sendmsg | expand |
Hello, syzbot has tested the proposed patch and the reproducer did not trigger any issue: Reported-and-tested-by: syzbot+ecab4d36f920c3574bf9@syzkaller.appspotmail.com Tested on: commit: 25236c91 af_unix: Fix task hung while purging oob_skb .. git tree: git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git console output: https://syzkaller.appspot.com/x/log.txt?x=151b970c180000 kernel config: https://syzkaller.appspot.com/x/.config?x=c368c5806a3ee9fc dashboard link: https://syzkaller.appspot.com/bug?extid=ecab4d36f920c3574bf9 compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40 patch: https://syzkaller.appspot.com/x/patch.diff?x=13ecdffc180000 Note: testing is done by a robot and is best-effort only.
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 51acf795f096..3b345b7a228b 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -340,13 +340,18 @@ static void __unix_gc(struct work_struct *work) __skb_queue_purge(&hitlist); #if IS_ENABLED(CONFIG_AF_UNIX_OOB) - while (!list_empty(&gc_candidates)) { - u = list_entry(gc_candidates.next, struct unix_sock, link); + u = list_first_entry_or_null(&gc_candidates, struct unix_sock, link); + + while (u) { if (u->oob_skb) { struct sk_buff *skb = u->oob_skb; u->oob_skb = NULL; kfree_skb(skb); + + u = list_first_entry_or_null(&gc_candidates, struct unix_sock, link); + } else { + u = list_next_entry(u, link); } } #endif