<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/net/sctp/inqueue.c, branch v6.12.80</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-10-29T13:08:55+00:00</updated>
<entry>
<title>sctp: avoid NULL dereference when chunk data buffer is missing</title>
<updated>2025-10-29T13:08:55+00:00</updated>
<author>
<name>Alexey Simakov</name>
<email>bigalex934@gmail.com</email>
</author>
<published>2025-10-21T13:00:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7a832b0f99be19df608cb75c023f8027b1789bd1'/>
<id>urn:sha1:7a832b0f99be19df608cb75c023f8027b1789bd1</id>
<content type='text'>
[ Upstream commit 441f0647f7673e0e64d4910ef61a5fb8f16bfb82 ]

chunk-&gt;skb pointer is dereferenced in the if-block where it's supposed
to be NULL only.

chunk-&gt;skb can only be NULL if chunk-&gt;head_skb is not. Check for frag_list
instead and do it just before replacing chunk-&gt;skb. We're sure that
otherwise chunk-&gt;skb is non-NULL because of outer if() condition.

Fixes: 90017accff61 ("sctp: Add GSO support")
Signed-off-by: Alexey Simakov &lt;bigalex934@gmail.com&gt;
Acked-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Link: https://patch.msgid.link/20251021130034.6333-1-bigalex934@gmail.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: sctp: fix skb leak in sctp_inq_free()</title>
<updated>2024-02-15T15:34:52+00:00</updated>
<author>
<name>Dmitry Antipov</name>
<email>dmantipov@yandex.ru</email>
</author>
<published>2024-02-14T08:22:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4e45170d9acc2d5ae8f545bf3f2f67504a361338'/>
<id>urn:sha1:4e45170d9acc2d5ae8f545bf3f2f67504a361338</id>
<content type='text'>
In case of GSO, 'chunk-&gt;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-&gt;skb' is set to 'chunk-&gt;head_skb' (i.e. fraglist head)
before calling 'sctp_chunk_free()', and use the aforementioned
helper in 'sctp_inq_pop()' as well.

Reported-by: syzbot+8bb053b5d63595ab47db@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?id=0d8351bbe54fd04a492c2daab0164138db008042
Fixes: 90017accff61 ("sctp: Add GSO support")
Suggested-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Signed-off-by: Dmitry Antipov &lt;dmantipov@yandex.ru&gt;
Acked-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Link: https://lore.kernel.org/r/20240214082224.10168-1-dmantipov@yandex.ru
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 104</title>
<updated>2019-05-24T15:39:00+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2019-05-23T09:14:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=47505b8bcfcffffe878ea1fee412922f3bfd7262'/>
<id>urn:sha1:47505b8bcfcffffe878ea1fee412922f3bfd7262</id>
<content type='text'>
Based on 1 normalized pattern(s):

  this sctp implementation is free software you can redistribute it
  and or modify it under the terms of the gnu general public license
  as published by the free software foundation either version 2 or at
  your option any later version this sctp implementation is
  distributed in the hope that it will be useful but without any
  warranty without even the implied warranty of merchantability or
  fitness for a particular purpose see the gnu general public license
  for more details you should have received a copy of the gnu general
  public license along with gnu cc see the file copying if not see
  http www gnu org licenses

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 42 file(s).

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Kate Stewart &lt;kstewart@linuxfoundation.org&gt;
Reviewed-by: Richard Fontana &lt;rfontana@redhat.com&gt;
Reviewed-by: Allison Randal &lt;allison@lohutok.net&gt;
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190523091649.683323110@linutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>sctp: fix the issue that the cookie-ack with auth can't get processed</title>
<updated>2018-05-02T15:15:33+00:00</updated>
<author>
<name>Xin Long</name>
<email>lucien.xin@gmail.com</email>
</author>
<published>2018-05-02T05:45:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ce402f044e4e432c296f90eaabb8dbe8f3624391'/>
<id>urn:sha1:ce402f044e4e432c296f90eaabb8dbe8f3624391</id>
<content type='text'>
When auth is enabled for cookie-ack chunk, in sctp_inq_pop, sctp
processes auth chunk first, then continues to the next chunk in
this packet if chunk_end + chunk_hdr size &lt; skb_tail_pointer().
Otherwise, it will go to the next packet or discard this chunk.

However, it missed the fact that cookie-ack chunk's size is equal
to chunk_hdr size, which couldn't match that check, and thus this
chunk would not get processed.

This patch fixes it by changing the check to chunk_end + chunk_hdr
size &lt;= skb_tail_pointer().

Fixes: 26b87c788100 ("net: sctp: fix remote memory pressure from excessive queueing")
Signed-off-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Acked-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Acked-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: use skb_is_gso_sctp() instead of open-coding</title>
<updated>2018-03-09T16:41:47+00:00</updated>
<author>
<name>Daniel Axtens</name>
<email>dja@axtens.net</email>
</author>
<published>2018-03-09T03:06:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1dd27cde30e85774c77349c804229431616d594a'/>
<id>urn:sha1:1dd27cde30e85774c77349c804229431616d594a</id>
<content type='text'>
As well as the basic conversion, I noticed that a lot of the
SCTP code checks gso_type without first checking skb_is_gso()
so I have added that where appropriate.

Also, document the helper.

Cc: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Cc: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: Daniel Axtens &lt;dja@axtens.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: remove the typedef sctp_chunkhdr_t</title>
<updated>2017-07-01T16:08:41+00:00</updated>
<author>
<name>Xin Long</name>
<email>lucien.xin@gmail.com</email>
</author>
<published>2017-06-30T03:52:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=922dbc5be2186659d2c453a53f2ae569e55b6101'/>
<id>urn:sha1:922dbc5be2186659d2c453a53f2ae569e55b6101</id>
<content type='text'>
This patch is to remove the typedef sctp_chunkhdr_t, and replace
with struct sctp_chunkhdr in the places where it's using this
typedef.

It is also to fix some indents and use sizeof(variable) instead
of sizeof(type)., especially in sctp_new.

Signed-off-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: rename WORD_TRUNC/ROUND macros</title>
<updated>2016-09-22T07:13:26+00:00</updated>
<author>
<name>Marcelo Ricardo Leitner</name>
<email>marcelo.leitner@gmail.com</email>
</author>
<published>2016-09-21T11:45:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e2f036a97271cf5811ee754bf321a29a814577f9'/>
<id>urn:sha1:e2f036a97271cf5811ee754bf321a29a814577f9</id>
<content type='text'>
To something more meaningful these days, specially because this is
working on packet headers or lengths and which are not tied to any CPU
arch but to the protocol itself.

So, WORD_TRUNC becomes SCTP_TRUNC4 and WORD_ROUND becomes SCTP_PAD4.

Reported-by: David Laight &lt;David.Laight@ACULAB.COM&gt;
Reported-by: David Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: linearize early if it's not GSO</title>
<updated>2016-08-20T00:09:42+00:00</updated>
<author>
<name>Marcelo Ricardo Leitner</name>
<email>marcelo.leitner@gmail.com</email>
</author>
<published>2016-08-18T17:58:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4c2f2454964477c66ef57745daab203b71783f66'/>
<id>urn:sha1:4c2f2454964477c66ef57745daab203b71783f66</id>
<content type='text'>
Because otherwise when crc computation is still needed it's way more
expensive than on a linear buffer to the point that it affects
performance.

It's so expensive that netperf test gives a perf output as below:

Overhead  Command         Shared Object       Symbol
  18,62%  netserver       [kernel.vmlinux]    [k] crc32_generic_shift
   2,57%  netserver       [kernel.vmlinux]    [k] __pskb_pull_tail
   1,94%  netserver       [kernel.vmlinux]    [k] fib_table_lookup
   1,90%  netserver       [kernel.vmlinux]    [k] copy_user_enhanced_fast_string
   1,66%  swapper         [kernel.vmlinux]    [k] intel_idle
   1,63%  netserver       [kernel.vmlinux]    [k] _raw_spin_lock
   1,59%  netserver       [sctp]              [k] sctp_packet_transmit
   1,55%  netserver       [kernel.vmlinux]    [k] memcpy_erms
   1,42%  netserver       [sctp]              [k] sctp_rcv

# netperf -H 192.168.10.1 -l 10 -t SCTP_STREAM -cC -- -m 12000
SCTP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.10.1 () port 0 AF_INET
Recv   Send    Send                          Utilization       Service Demand
Socket Socket  Message  Elapsed              Send     Recv     Send    Recv
Size   Size    Size     Time     Throughput  local    remote   local   remote
bytes  bytes   bytes    secs.    10^6bits/s  % S      % S      us/KB   us/KB

212992 212992  12000    10.00      3016.42   2.88     3.78     1.874   2.462

After patch:
Overhead  Command         Shared Object      Symbol
   2,75%  netserver       [kernel.vmlinux]   [k] memcpy_erms
   2,63%  netserver       [kernel.vmlinux]   [k] copy_user_enhanced_fast_string
   2,39%  netserver       [kernel.vmlinux]   [k] fib_table_lookup
   2,04%  netserver       [kernel.vmlinux]   [k] __pskb_pull_tail
   1,91%  netserver       [kernel.vmlinux]   [k] _raw_spin_lock
   1,91%  netserver       [sctp]             [k] sctp_packet_transmit
   1,72%  netserver       [mlx4_en]          [k] mlx4_en_process_rx_cq
   1,68%  netserver       [sctp]             [k] sctp_rcv

# netperf -H 192.168.10.1 -l 10 -t SCTP_STREAM -cC -- -m 12000
SCTP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.10.1 () port 0 AF_INET
Recv   Send    Send                          Utilization       Service Demand
Socket Socket  Message  Elapsed              Send     Recv     Send    Recv
Size   Size    Size     Time     Throughput  local    remote   local   remote
bytes  bytes   bytes    secs.    10^6bits/s  % S      % S      us/KB   us/KB

212992 212992  12000    10.00      3681.77   3.83     3.46     2.045   1.849

Fixes: 3acb50c18d8d ("sctp: delay as much as possible skb_linearize")
Signed-off-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: fix BH handling on socket backlog</title>
<updated>2016-07-25T18:22:22+00:00</updated>
<author>
<name>Marcelo Ricardo Leitner</name>
<email>marcelo.leitner@gmail.com</email>
</author>
<published>2016-07-23T03:32:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=eefc1b1d105ee4d2ce907833ce675f1e9599b5e3'/>
<id>urn:sha1:eefc1b1d105ee4d2ce907833ce675f1e9599b5e3</id>
<content type='text'>
Now that the backlog processing is called with BH enabled, we have to
disable BH before taking the socket lock via bh_lock_sock() otherwise
it may dead lock:

sctp_backlog_rcv()
                bh_lock_sock(sk);

                if (sock_owned_by_user(sk)) {
                        if (sk_add_backlog(sk, skb, sk-&gt;sk_rcvbuf))
                                sctp_chunk_free(chunk);
                        else
                                backloged = 1;
                } else
                        sctp_inq_push(inqueue, chunk);

                bh_unlock_sock(sk);

while sctp_inq_push() was disabling/enabling BH, but enabling BH
triggers pending softirq, which then may try to re-lock the socket in
sctp_rcv().

[  219.187215]  &lt;IRQ&gt;
[  219.187217]  [&lt;ffffffff817ca3e0&gt;] _raw_spin_lock+0x20/0x30
[  219.187223]  [&lt;ffffffffa041888c&gt;] sctp_rcv+0x48c/0xba0 [sctp]
[  219.187225]  [&lt;ffffffff816e7db2&gt;] ? nf_iterate+0x62/0x80
[  219.187226]  [&lt;ffffffff816f1b14&gt;] ip_local_deliver_finish+0x94/0x1e0
[  219.187228]  [&lt;ffffffff816f1e1f&gt;] ip_local_deliver+0x6f/0xf0
[  219.187229]  [&lt;ffffffff816f1a80&gt;] ? ip_rcv_finish+0x3b0/0x3b0
[  219.187230]  [&lt;ffffffff816f17a8&gt;] ip_rcv_finish+0xd8/0x3b0
[  219.187232]  [&lt;ffffffff816f2122&gt;] ip_rcv+0x282/0x3a0
[  219.187233]  [&lt;ffffffff810d8bb6&gt;] ? update_curr+0x66/0x180
[  219.187235]  [&lt;ffffffff816abac4&gt;] __netif_receive_skb_core+0x524/0xa90
[  219.187236]  [&lt;ffffffff810d8e00&gt;] ? update_cfs_shares+0x30/0xf0
[  219.187237]  [&lt;ffffffff810d557c&gt;] ? __enqueue_entity+0x6c/0x70
[  219.187239]  [&lt;ffffffff810dc454&gt;] ? enqueue_entity+0x204/0xdf0
[  219.187240]  [&lt;ffffffff816ac048&gt;] __netif_receive_skb+0x18/0x60
[  219.187242]  [&lt;ffffffff816ad1ce&gt;] process_backlog+0x9e/0x140
[  219.187243]  [&lt;ffffffff816ac8ec&gt;] net_rx_action+0x22c/0x370
[  219.187245]  [&lt;ffffffff817cd352&gt;] __do_softirq+0x112/0x2e7
[  219.187247]  [&lt;ffffffff817cc3bc&gt;] do_softirq_own_stack+0x1c/0x30
[  219.187247]  &lt;EOI&gt;
[  219.187248]  [&lt;ffffffff810aa1c8&gt;] do_softirq.part.14+0x38/0x40
[  219.187249]  [&lt;ffffffff810aa24d&gt;] __local_bh_enable_ip+0x7d/0x80
[  219.187254]  [&lt;ffffffffa0408428&gt;] sctp_inq_push+0x68/0x80 [sctp]
[  219.187258]  [&lt;ffffffffa04190f1&gt;] sctp_backlog_rcv+0x151/0x1c0 [sctp]
[  219.187260]  [&lt;ffffffff81692b07&gt;] __release_sock+0x87/0xf0
[  219.187261]  [&lt;ffffffff81692ba0&gt;] release_sock+0x30/0xa0
[  219.187265]  [&lt;ffffffffa040e46d&gt;] sctp_accept+0x17d/0x210 [sctp]
[  219.187266]  [&lt;ffffffff810e7510&gt;] ? prepare_to_wait_event+0xf0/0xf0
[  219.187268]  [&lt;ffffffff8172d52c&gt;] inet_accept+0x3c/0x130
[  219.187269]  [&lt;ffffffff8168d7a3&gt;] SYSC_accept4+0x103/0x210
[  219.187271]  [&lt;ffffffff817ca2ba&gt;] ? _raw_spin_unlock_bh+0x1a/0x20
[  219.187272]  [&lt;ffffffff81692bfc&gt;] ? release_sock+0x8c/0xa0
[  219.187276]  [&lt;ffffffffa0413e22&gt;] ? sctp_inet_listen+0x62/0x1b0 [sctp]
[  219.187277]  [&lt;ffffffff8168f2d0&gt;] SyS_accept+0x10/0x20

Fixes: 860fbbc343bf ("sctp: prepare for socket backlog behavior change")
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: do not clear chunk-&gt;ecn_ce_done flag</title>
<updated>2016-07-14T01:10:14+00:00</updated>
<author>
<name>Marcelo Ricardo Leitner</name>
<email>marcelo.leitner@gmail.com</email>
</author>
<published>2016-07-13T18:08:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d9cef42529402f9fce10376b6e427a5137d90c3d'/>
<id>urn:sha1:d9cef42529402f9fce10376b6e427a5137d90c3d</id>
<content type='text'>
We should not clear that flag when switching to a new skb from a GSO skb
because it would cause ECN processing to happen multiple times per GSO
skb, which is not wanted. Instead, let it be processed once per chunk.
That is, in other words, once per IP header available.

Fixes: 90017accff61 ("sctp: Add GSO support")
Signed-off-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
