* [PATCH net] sctp: initialize more fields in sctp_v6_from_sk()
@ 2025-08-26 14:13 Eric Dumazet
2025-08-26 14:29 ` Xin Long
2025-08-28 0:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2025-08-26 14:13 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, netdev, eric.dumazet, Eric Dumazet,
syzbot+e69f06a0f30116c68056, Marcelo Ricardo Leitner, Xin Long
syzbot found that sin6_scope_id was not properly initialized,
leading to undefined behavior.
Clear sin6_scope_id and sin6_flowinfo.
BUG: KMSAN: uninit-value in __sctp_v6_cmp_addr+0x887/0x8c0 net/sctp/ipv6.c:649
__sctp_v6_cmp_addr+0x887/0x8c0 net/sctp/ipv6.c:649
sctp_inet6_cmp_addr+0x4f2/0x510 net/sctp/ipv6.c:983
sctp_bind_addr_conflict+0x22a/0x3b0 net/sctp/bind_addr.c:390
sctp_get_port_local+0x21eb/0x2440 net/sctp/socket.c:8452
sctp_get_port net/sctp/socket.c:8523 [inline]
sctp_listen_start net/sctp/socket.c:8567 [inline]
sctp_inet_listen+0x710/0xfd0 net/sctp/socket.c:8636
__sys_listen_socket net/socket.c:1912 [inline]
__sys_listen net/socket.c:1927 [inline]
__do_sys_listen net/socket.c:1932 [inline]
__se_sys_listen net/socket.c:1930 [inline]
__x64_sys_listen+0x343/0x4c0 net/socket.c:1930
x64_sys_call+0x271d/0x3e20 arch/x86/include/generated/asm/syscalls_64.h:51
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Local variable addr.i.i created at:
sctp_get_port net/sctp/socket.c:8515 [inline]
sctp_listen_start net/sctp/socket.c:8567 [inline]
sctp_inet_listen+0x650/0xfd0 net/sctp/socket.c:8636
__sys_listen_socket net/socket.c:1912 [inline]
__sys_listen net/socket.c:1927 [inline]
__do_sys_listen net/socket.c:1932 [inline]
__se_sys_listen net/socket.c:1930 [inline]
__x64_sys_listen+0x343/0x4c0 net/socket.c:1930
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: syzbot+e69f06a0f30116c68056@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/68adc0a2.050a0220.37038e.00c4.GAE@google.com/T/#u
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Cc: Xin Long <lucien.xin@gmail.com>
---
net/sctp/ipv6.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 3336dcfb451509927a4ae3c2bf76c574c743936b..568ff8797c393bea28f8423babd4c85d6407f9ff 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -547,7 +547,9 @@ static void sctp_v6_from_sk(union sctp_addr *addr, struct sock *sk)
{
addr->v6.sin6_family = AF_INET6;
addr->v6.sin6_port = 0;
+ addr->v6.sin6_flowinfo = 0;
addr->v6.sin6_addr = sk->sk_v6_rcv_saddr;
+ addr->v6.sin6_scope_id = 0;
}
/* Initialize sk->sk_rcv_saddr from sctp_addr. */
--
2.51.0.261.g7ce5a0a67e-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] sctp: initialize more fields in sctp_v6_from_sk()
2025-08-26 14:13 [PATCH net] sctp: initialize more fields in sctp_v6_from_sk() Eric Dumazet
@ 2025-08-26 14:29 ` Xin Long
2025-08-28 0:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Xin Long @ 2025-08-26 14:29 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
netdev, eric.dumazet, syzbot+e69f06a0f30116c68056,
Marcelo Ricardo Leitner
On Tue, Aug 26, 2025 at 10:13 AM Eric Dumazet <edumazet@google.com> wrote:
>
> syzbot found that sin6_scope_id was not properly initialized,
> leading to undefined behavior.
>
> Clear sin6_scope_id and sin6_flowinfo.
>
> BUG: KMSAN: uninit-value in __sctp_v6_cmp_addr+0x887/0x8c0 net/sctp/ipv6.c:649
> __sctp_v6_cmp_addr+0x887/0x8c0 net/sctp/ipv6.c:649
> sctp_inet6_cmp_addr+0x4f2/0x510 net/sctp/ipv6.c:983
> sctp_bind_addr_conflict+0x22a/0x3b0 net/sctp/bind_addr.c:390
> sctp_get_port_local+0x21eb/0x2440 net/sctp/socket.c:8452
> sctp_get_port net/sctp/socket.c:8523 [inline]
> sctp_listen_start net/sctp/socket.c:8567 [inline]
> sctp_inet_listen+0x710/0xfd0 net/sctp/socket.c:8636
> __sys_listen_socket net/socket.c:1912 [inline]
> __sys_listen net/socket.c:1927 [inline]
> __do_sys_listen net/socket.c:1932 [inline]
> __se_sys_listen net/socket.c:1930 [inline]
> __x64_sys_listen+0x343/0x4c0 net/socket.c:1930
> x64_sys_call+0x271d/0x3e20 arch/x86/include/generated/asm/syscalls_64.h:51
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Local variable addr.i.i created at:
> sctp_get_port net/sctp/socket.c:8515 [inline]
> sctp_listen_start net/sctp/socket.c:8567 [inline]
> sctp_inet_listen+0x650/0xfd0 net/sctp/socket.c:8636
> __sys_listen_socket net/socket.c:1912 [inline]
> __sys_listen net/socket.c:1927 [inline]
> __do_sys_listen net/socket.c:1932 [inline]
> __se_sys_listen net/socket.c:1930 [inline]
> __x64_sys_listen+0x343/0x4c0 net/socket.c:1930
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Reported-by: syzbot+e69f06a0f30116c68056@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/netdev/68adc0a2.050a0220.37038e.00c4.GAE@google.com/T/#u
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> Cc: Xin Long <lucien.xin@gmail.com>
> ---
> net/sctp/ipv6.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
> index 3336dcfb451509927a4ae3c2bf76c574c743936b..568ff8797c393bea28f8423babd4c85d6407f9ff 100644
> --- a/net/sctp/ipv6.c
> +++ b/net/sctp/ipv6.c
> @@ -547,7 +547,9 @@ static void sctp_v6_from_sk(union sctp_addr *addr, struct sock *sk)
> {
> addr->v6.sin6_family = AF_INET6;
> addr->v6.sin6_port = 0;
> + addr->v6.sin6_flowinfo = 0;
> addr->v6.sin6_addr = sk->sk_v6_rcv_saddr;
> + addr->v6.sin6_scope_id = 0;
> }
>
> /* Initialize sk->sk_rcv_saddr from sctp_addr. */
> --
> 2.51.0.261.g7ce5a0a67e-goog
>
Acked-by: Xin Long <lucien.xin@gmail.com>
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] sctp: initialize more fields in sctp_v6_from_sk()
2025-08-26 14:13 [PATCH net] sctp: initialize more fields in sctp_v6_from_sk() Eric Dumazet
2025-08-26 14:29 ` Xin Long
@ 2025-08-28 0:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-28 0:30 UTC (permalink / raw)
To: Eric Dumazet
Cc: davem, kuba, pabeni, horms, netdev, eric.dumazet,
syzbot+e69f06a0f30116c68056, marcelo.leitner, lucien.xin
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 26 Aug 2025 14:13:14 +0000 you wrote:
> syzbot found that sin6_scope_id was not properly initialized,
> leading to undefined behavior.
>
> Clear sin6_scope_id and sin6_flowinfo.
>
> BUG: KMSAN: uninit-value in __sctp_v6_cmp_addr+0x887/0x8c0 net/sctp/ipv6.c:649
> __sctp_v6_cmp_addr+0x887/0x8c0 net/sctp/ipv6.c:649
> sctp_inet6_cmp_addr+0x4f2/0x510 net/sctp/ipv6.c:983
> sctp_bind_addr_conflict+0x22a/0x3b0 net/sctp/bind_addr.c:390
> sctp_get_port_local+0x21eb/0x2440 net/sctp/socket.c:8452
> sctp_get_port net/sctp/socket.c:8523 [inline]
> sctp_listen_start net/sctp/socket.c:8567 [inline]
> sctp_inet_listen+0x710/0xfd0 net/sctp/socket.c:8636
> __sys_listen_socket net/socket.c:1912 [inline]
> __sys_listen net/socket.c:1927 [inline]
> __do_sys_listen net/socket.c:1932 [inline]
> __se_sys_listen net/socket.c:1930 [inline]
> __x64_sys_listen+0x343/0x4c0 net/socket.c:1930
> x64_sys_call+0x271d/0x3e20 arch/x86/include/generated/asm/syscalls_64.h:51
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> [...]
Here is the summary with links:
- [net] sctp: initialize more fields in sctp_v6_from_sk()
https://git.kernel.org/netdev/net/c/2e8750469242
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-28 0:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-26 14:13 [PATCH net] sctp: initialize more fields in sctp_v6_from_sk() Eric Dumazet
2025-08-26 14:29 ` Xin Long
2025-08-28 0:30 ` patchwork-bot+netdevbpf
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).