Skip to contentSkip to conversation

net: sctp: fix KMSAN uninit-value in sctp_inq_pop

PATCH Superseded Ranganath V N 3 participants 3 messages Oct 24, 2025

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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 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
index 7e99894778d4..e119e460ccde 100644
@@ -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]>
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 12 lines · Ranganath V N

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))
Quoted 7 lines

To handle this safely, a new check should be performed after sk_filter().

Thanks for the follow up.

reviewer
#2 lore raw
In reply to Ranganath V N
Quoted 9 lines · Ranganath V N

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:

Quoted 7 lines
        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().

Hi,

Thanks for your patch.

Unfortunately, this is not the correct format for a fixes tag. A fixes tag should reference the commit where the bug was introduced into the tree. In this case, perhaps that is the beginning of git history. If so:

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")

I think the URL you provide is appropriate for a Closed tag.

See https://docs.kernel.org/process/submitting-patches.html

Quoted 9 lines

---
KMSAN reported an uninitialized-value access in sctp_inq_pop
---
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]

...