From: David Miller <davem@davemloft.net>
To: alexey.kodanev@oracle.com
Cc: netdev@vger.kernel.org, marcelo.leitner@gmail.com,
nhorman@tuxdriver.com, vyasevich@gmail.com,
linux-sctp@vger.kernel.org
Subject: Re: [PATCH net v2] sctp: verify size of a new chunk in _sctp_make_chunk()
Date: Fri, 09 Feb 2018 14:32:23 -0500 (EST) [thread overview]
Message-ID: <20180209.143223.1410582840717699699.davem@davemloft.net> (raw)
In-Reply-To: <1518186923-28650-1-git-send-email-alexey.kodanev@oracle.com>
From: Alexey Kodanev <alexey.kodanev@oracle.com>
Date: Fri, 9 Feb 2018 17:35:23 +0300
> When SCTP makes INIT or INIT_ACK packet the total chunk length
> can exceed SCTP_MAX_CHUNK_LEN which leads to kernel panic when
> transmitting these packets, e.g. the crash on sending INIT_ACK:
...
> Here the chunk size for INIT_ACK packet becomes too big, mostly
> because of the state cookie (INIT packet has large size with
> many address parameters), plus additional server parameters.
>
> Later this chunk causes the panic in skb_put_data():
>
> skb_packet_transmit()
> sctp_packet_pack()
> skb_put_data(nskb, chunk->skb->data, chunk->skb->len);
>
> 'nskb' (head skb) was previously allocated with packet->size
> from u16 'chunk->chunk_hdr->length'.
>
> As suggested by Marcelo we should check the chunk's length in
> _sctp_make_chunk() before trying to allocate skb for it and
> discard a chunk if its size bigger than SCTP_MAX_CHUNK_LEN.
>
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Applied and queued up for -stable, thanks.
prev parent reply other threads:[~2018-02-09 19:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-09 14:35 [PATCH net v2] sctp: verify size of a new chunk in _sctp_make_chunk() Alexey Kodanev
2018-02-09 14:40 ` Marcelo Ricardo Leitner
2018-02-09 15:02 ` Neil Horman
2018-02-09 19:32 ` David Miller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180209.143223.1410582840717699699.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=alexey.kodanev@oracle.com \
--cc=linux-sctp@vger.kernel.org \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=vyasevich@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).