net: sctp: fix KMSAN uninit-value in sctp_inq_pop
Subsystems (3)
PATCH v3 1/1 net: sctp: fix KMSAN uninit-value in sctp_inq_pop
Fix an issue detected by syzbot:
KMSAN reported an uninitialized-value access in sctp_inq_pop
BUG: KMSAN: uninit-value in sctp_inq_pop
The issue is actually caused by skb trimming via sk_filter() in sctp_rcv(). In the reproducer, skb->len becomes 1 after sk_filter(), which bypassed the original check:
if (skb->len < sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr) +
skb_transport_offset(skb))To handle this safely, a new check should be performed after sk_filter().
---
KMSAN reported an uninitialized-value access in sctp_inq_pop
---
Changes in v3:
- fixes the patch format like fixes and closes tags.
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- changes in commit message as per the code changes.
- fixed as per the suggestion.
- Link to v1: https://lore.kernel.org/r/[email protected]
--- net/sctp/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sctp/input.c +1 -1
@@ -190,7 +190,7 @@ int sctp_rcv(struct sk_buff *skb) goto discard_release;nf_reset_ct (skb); -if (sk_filter (sk, skb)) +if (sk_filter (sk, skb) || skb->len <sizeof (struct sctp_chunkhdr )) goto discard_release;/* Create an SCTP packet structure. */
---
base-commit: 43e9ad0c55a369ecc84a4788d06a8a6bfa634f1c
change-id: 20251023-kmsan_fix-78d527b9960b
Best regards,
Signature · 1 line
Ranganath V N <[email protected]>
Quoted 19 lines · Ranganath V N
Fix an issue detected by syzbot:
KMSAN reported an uninitialized-value access in
sctp_inq_popBUG: KMSAN: uninit-value in sctp_inq_popThe issue is actually caused by skb trimming via
sk_filter()insctp_rcv(). In the reproducer,skb->lenbecomes 1 aftersk_filter(), which bypassed the original check:if (skb->len < sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr) + skb_transport_offset(skb))To handle this safely, a new check should be performed after
sk_filter().Reported-by [email protected]Tested-by [email protected]Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")Suggested-by Xin Long <[email protected]>Signed-off-by Ranganath V N <[email protected]>
Quoted 6 lines
---
KMSAN reported an uninitialized-value access insctp_inq_pop
---
Changes in v3:
- fixes the patch format like fixes and closes tags.
- Link to v2: https://lore.kernel.org/r/[email protected]
Thanks for the update. This version looks good to me. And I assume it is for net.
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 10 lines · On Sun, 26 Oct 2025 22:03:12 +0530 you wrote:
Fix an issue detected by syzbot:
KMSAN reported an uninitialized-value access in
sctp_inq_popBUG: KMSAN: uninit-value in sctp_inq_popThe issue is actually caused by skb trimming via
sk_filter()insctp_rcv(). In the reproducer,skb->lenbecomes 1 aftersk_filter(), which bypassed the original check:[...]
Here is the summary with links:
- [v3] net: sctp: fix KMSAN uninit-value in sctp_inq_pop
https://git.kernel.org/netdev/net/c/51e5ad549c43
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html