Skip to content

Commit 51e5ad5

Browse files
ranganathvnPaolo Abeni
authored andcommitted
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(). Reported-by: [email protected] Tested-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=d101e12bccd4095460e7 Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Suggested-by: Xin Long <[email protected]> Signed-off-by: Ranganath V N <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 6a2108c commit 51e5ad5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/sctp/input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ int sctp_rcv(struct sk_buff *skb)
190190
goto discard_release;
191191
nf_reset_ct(skb);
192192

193-
if (sk_filter(sk, skb))
193+
if (sk_filter(sk, skb) || skb->len < sizeof(struct sctp_chunkhdr))
194194
goto discard_release;
195195

196196
/* Create an SCTP packet structure. */

0 commit comments

Comments
 (0)