netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [syzbot] [fs?] kernel BUG in sctp_getsockopt_peeloff_common
       [not found] <692d66d3.a70a0220.2ea503.00b2.GAE@google.com>
@ 2025-12-01 22:09 ` syzbot
  2025-12-04 22:53   ` Xin Long
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2025-12-01 22:09 UTC (permalink / raw)
  To: brauner, davem, edumazet, horms, jack, kuba, linux-fsdevel,
	linux-kernel, linux-sctp, lucien.xin, marcelo.leitner, mjguzik,
	netdev, pabeni, syzkaller-bugs, torvalds, viro

syzbot has bisected this issue to:

commit 457528eb27c3a3053181939ca65998477cc39c49
Author: Christian Brauner <brauner@kernel.org>
Date:   Sun Nov 23 16:33:47 2025 +0000

    net/sctp: convert sctp_getsockopt_peeloff_common() to FD_PREPARE()

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=1136a512580000
start commit:   7d31f578f323 Add linux-next specific files for 20251128
git tree:       linux-next
final oops:     https://syzkaller.appspot.com/x/report.txt?x=1336a512580000
console output: https://syzkaller.appspot.com/x/log.txt?x=1536a512580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=6336d8e94a7c517d
dashboard link: https://syzkaller.appspot.com/bug?extid=984a5c208d87765b2ee7
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=16a2322c580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12a3c512580000

Reported-by: syzbot+984a5c208d87765b2ee7@syzkaller.appspotmail.com
Fixes: 457528eb27c3 ("net/sctp: convert sctp_getsockopt_peeloff_common() to FD_PREPARE()")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [syzbot] [fs?] kernel BUG in sctp_getsockopt_peeloff_common
  2025-12-01 22:09 ` [syzbot] [fs?] kernel BUG in sctp_getsockopt_peeloff_common syzbot
@ 2025-12-04 22:53   ` Xin Long
  2025-12-05  9:44     ` Christian Brauner
  0 siblings, 1 reply; 3+ messages in thread
From: Xin Long @ 2025-12-04 22:53 UTC (permalink / raw)
  To: syzbot
  Cc: brauner, davem, edumazet, horms, jack, kuba, linux-fsdevel,
	linux-kernel, linux-sctp, marcelo.leitner, mjguzik, netdev,
	pabeni, syzkaller-bugs, torvalds, viro

On Mon, Dec 1, 2025 at 5:09 PM syzbot
<syzbot+984a5c208d87765b2ee7@syzkaller.appspotmail.com> wrote:
>
> syzbot has bisected this issue to:
>
> commit 457528eb27c3a3053181939ca65998477cc39c49
> Author: Christian Brauner <brauner@kernel.org>
> Date:   Sun Nov 23 16:33:47 2025 +0000
>
>     net/sctp: convert sctp_getsockopt_peeloff_common() to FD_PREPARE()
>
> bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=1136a512580000
> start commit:   7d31f578f323 Add linux-next specific files for 20251128
> git tree:       linux-next
> final oops:     https://syzkaller.appspot.com/x/report.txt?x=1336a512580000
> console output: https://syzkaller.appspot.com/x/log.txt?x=1536a512580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=6336d8e94a7c517d
> dashboard link: https://syzkaller.appspot.com/bug?extid=984a5c208d87765b2ee7
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=16a2322c580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12a3c512580000
>
> Reported-by: syzbot+984a5c208d87765b2ee7@syzkaller.appspotmail.com
> Fixes: 457528eb27c3 ("net/sctp: convert sctp_getsockopt_peeloff_common() to FD_PREPARE()")
This commit seems to no longer exist.

But I triggered a similar call trace with FAULT_INJECTION on net-next.git:

 [] FAULT_INJECTION: forcing a failure.
 [] Call Trace:
 []  <TASK>
 []  dump_stack_lvl+0x180/0x1b0
 []  should_fail_ex+0x520/0x650
 []  should_failslab+0xc2/0x120
 []  kmem_cache_alloc_lru_noprof+0x7a/0x780
 []  d_alloc_pseudo+0x1d/0xc0
 []  alloc_file_pseudo+0xbe/0x220
 []  sock_alloc_file+0x53/0x220
 []  __sys_socket+0x1be/0x320
 [] VFS_BUG_ON_INODE(inode_state_read_once(inode) & I_CLEAR)
encountered for inode ffff888054f9a900
 [] ------------[ cut here ]------------
 [] kernel BUG at fs/inode.c:1971!
 [] Call Trace:
 []  <TASK>
 []  iput+0x35/0x40
 []  __sock_release+0x20b/0x270
 []  __sys_socket+0x276/0x320
 []  __x64_sys_socket+0x72/0xb0

which was caused by:

commit 245f0d1c622b0183ce4f44b3e39aeacf78fae594
Author: Christian Brauner <brauner@kernel.org>
Date:   Sun Nov 23 17:33:48 2025 +0100

    net/socket: convert sock_map_fd() to FD_ADD()

static int sock_map_fd(struct socket *sock, int flags)
{
        int fd;

        fd = FD_ADD(flags, sock_alloc_file(sock, flags, NULL));
        if (fd < 0)
                sock_release(sock);
        return fd;
}

The allocation failure in sock_alloc_file() will call sock_release(),
and it should not be called again in sock_map_fd().

It could be fixed by:

diff --git a/net/socket.c b/net/socket.c
index 809ef372727b..0c2b03cec83d 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -503,12 +503,13 @@ EXPORT_SYMBOL(sock_alloc_file);

 static int sock_map_fd(struct socket *sock, int flags)
 {
-       int fd;
+       struct file *file;

-       fd = FD_ADD(flags, sock_alloc_file(sock, flags, NULL));
-       if (fd < 0)
-               sock_release(sock);
-       return fd;
+       file = sock_alloc_file(sock, flags, NULL);
+       if (IS_ERR(file))
+               return PTR_ERR(file);
+
+       return FD_ADD(flags, file);
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [syzbot] [fs?] kernel BUG in sctp_getsockopt_peeloff_common
  2025-12-04 22:53   ` Xin Long
@ 2025-12-05  9:44     ` Christian Brauner
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2025-12-05  9:44 UTC (permalink / raw)
  To: Xin Long
  Cc: syzbot, davem, edumazet, horms, jack, kuba, linux-fsdevel,
	linux-kernel, linux-sctp, marcelo.leitner, mjguzik, netdev,
	pabeni, syzkaller-bugs, torvalds, viro

> But I triggered a similar call trace with FAULT_INJECTION on net-next.git:

Thank you, I'll send a revert.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-05  9:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <692d66d3.a70a0220.2ea503.00b2.GAE@google.com>
2025-12-01 22:09 ` [syzbot] [fs?] kernel BUG in sctp_getsockopt_peeloff_common syzbot
2025-12-04 22:53   ` Xin Long
2025-12-05  9:44     ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).