Skip to content
Commit 4e45170d authored by Dmitry Antipov's avatar Dmitry Antipov Committed by Jakub Kicinski
Browse files

net: sctp: fix skb leak in sctp_inq_free()



In case of GSO, 'chunk->skb' pointer may point to an entry from
fraglist created in 'sctp_packet_gso_append()'. To avoid freeing
random fraglist entry (and so undefined behavior and/or memory
leak), introduce 'sctp_inq_chunk_free()' helper to ensure that
'chunk->skb' is set to 'chunk->head_skb' (i.e. fraglist head)
before calling 'sctp_chunk_free()', and use the aforementioned
helper in 'sctp_inq_pop()' as well.

Reported-by: default avatar <syzbot+8bb053b5d63595ab47db@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?id=0d8351bbe54fd04a492c2daab0164138db008042


Fixes: 90017acc ("sctp: Add GSO support")
Suggested-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDmitry Antipov <dmantipov@yandex.ru>
Acked-by: default avatarXin Long <lucien.xin@gmail.com>
Link: https://lore.kernel.org/r/20240214082224.10168-1-dmantipov@yandex.ru


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent e5b2e810
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment