<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/net/sctp/socket.c, branch linux-5.8.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.8.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.8.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-09-26T16:05:24Z</updated>
<entry>
<title>net: sctp: Fix IPv6 ancestor_size calc in sctp_copy_descendant</title>
<updated>2020-09-26T16:05:24Z</updated>
<author>
<name>Henry Ptasinski</name>
</author>
<published>2020-09-19T00:12:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5bda4b3ec1c9faf236b30d5892f5467c55300414'/>
<id>urn:sha1:5bda4b3ec1c9faf236b30d5892f5467c55300414</id>
<content type='text'>
[ Upstream commit fe81d9f6182d1160e625894eecb3d7ff0222cac5 ]

When calculating ancestor_size with IPv6 enabled, simply using
sizeof(struct ipv6_pinfo) doesn't account for extra bytes needed for
alignment in the struct sctp6_sock. On x86, there aren't any extra
bytes, but on ARM the ipv6_pinfo structure is aligned on an 8-byte
boundary so there were 4 pad bytes that were omitted from the
ancestor_size calculation.  This would lead to corruption of the
pd_lobby pointers, causing an oops when trying to free the sctp
structure on socket close.

Fixes: 636d25d557d1 ("sctp: not copy sctp_sock pd_lobby in sctp_copy_descendant")
Signed-off-by: Henry Ptasinski &lt;hptasinski@google.com&gt;
Acked-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>sctp: not disable bh in the whole sctp_get_port_local()</title>
<updated>2020-09-12T12:22:14Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2020-08-21T06:59:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=db16256c95ac7d74ecd43bce68f85a88663f3d9c'/>
<id>urn:sha1:db16256c95ac7d74ecd43bce68f85a88663f3d9c</id>
<content type='text'>
[ Upstream commit 3106ecb43a05dc3e009779764b9da245a5d082de ]

With disabling bh in the whole sctp_get_port_local(), when
snum == 0 and too many ports have been used, the do-while
loop will take the cpu for a long time and cause cpu stuck:

  [ ] watchdog: BUG: soft lockup - CPU#11 stuck for 22s!
  [ ] RIP: 0010:native_queued_spin_lock_slowpath+0x4de/0x940
  [ ] Call Trace:
  [ ]  _raw_spin_lock+0xc1/0xd0
  [ ]  sctp_get_port_local+0x527/0x650 [sctp]
  [ ]  sctp_do_bind+0x208/0x5e0 [sctp]
  [ ]  sctp_autobind+0x165/0x1e0 [sctp]
  [ ]  sctp_connect_new_asoc+0x355/0x480 [sctp]
  [ ]  __sctp_connect+0x360/0xb10 [sctp]

There's no need to disable bh in the whole function of
sctp_get_port_local. So fix this cpu stuck by removing
local_bh_disable() called at the beginning, and using
spin_lock_bh() instead.

The same thing was actually done for inet_csk_get_port() in
Commit ea8add2b1903 ("tcp/dccp: better use of ephemeral
ports in bind()").

Thanks to Marcelo for pointing the buggy code out.

v1-&gt;v2:
  - use cond_resched() to yield cpu to other tasks if needed,
    as Eric noticed.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Ying Xu &lt;yinxu@redhat.com&gt;
Signed-off-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Acked-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>net: add a new bind_add method</title>
<updated>2020-05-29T20:10:39Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2020-05-29T12:09:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c0425a4249e9d313eec5f81c0bde8a286ebf9a63'/>
<id>urn:sha1:c0425a4249e9d313eec5f81c0bde8a286ebf9a63</id>
<content type='text'>
The SCTP protocol allows to bind multiple address to a socket.  That
feature is currently only exposed as a socket option.  Add a bind_add
method struct proto that allows to bind additional addresses, and
switch the dlm code to use the method instead of going through the
socket option from kernel space.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&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>sctp: refactor sctp_setsockopt_bindx</title>
<updated>2020-05-29T20:10:39Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2020-05-29T12:09:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=05bfd3661448a46db3a258b316160d34cf0a1317'/>
<id>urn:sha1:05bfd3661448a46db3a258b316160d34cf0a1317</id>
<content type='text'>
Split out a sctp_setsockopt_bindx_kernel that takes a kernel pointer
to the sockaddr and make sctp_setsockopt_bindx a small wrapper around
it.  This prepares for adding a new bind_add proto op.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&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>Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net</title>
<updated>2020-03-31T03:48:43Z</updated>
<author>
<name>David S. Miller</name>
</author>
<published>2020-03-31T03:48:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5a470b1a63ac211e01a93de9d913753d64a21d9a'/>
<id>urn:sha1:5a470b1a63ac211e01a93de9d913753d64a21d9a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sctp: fix refcount bug in sctp_wfree</title>
<updated>2020-03-30T04:57:30Z</updated>
<author>
<name>Qiujun Huang</name>
</author>
<published>2020-03-27T03:07:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5c3e82fe159622e46e91458c1a6509c321a62820'/>
<id>urn:sha1:5c3e82fe159622e46e91458c1a6509c321a62820</id>
<content type='text'>
We should iterate over the datamsgs to move
all chunks(skbs) to newsk.

The following case cause the bug:
for the trouble SKB, it was in outq-&gt;transmitted list

sctp_outq_sack
        sctp_check_transmitted
                SKB was moved to outq-&gt;sacked list
        then throw away the sack queue
                SKB was deleted from outq-&gt;sacked
(but it was held by datamsg at sctp_datamsg_to_asoc
So, sctp_wfree was not called here)

then migrate happened

        sctp_for_each_tx_datachunk(
        sctp_clear_owner_w);
        sctp_assoc_migrate();
        sctp_for_each_tx_datachunk(
        sctp_set_owner_w);
SKB was not in the outq, and was not changed to newsk

finally

__sctp_outq_teardown
        sctp_chunk_put (for another skb)
                sctp_datamsg_put
                        __kfree_skb(msg-&gt;frag_list)
                                sctp_wfree (for SKB)
	SKB-&gt;sk was still oldsk (skb-&gt;sk != asoc-&gt;base.sk).

Reported-and-tested-by: syzbot+cea71eec5d6de256d54d@syzkaller.appspotmail.com
Signed-off-by: Qiujun Huang &lt;hqjagain@gmail.com&gt;
Acked-by: Marcelo Ricardo Leitner &lt;mleitner@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: Add missing annotation for sctp_transport_walk_stop()</title>
<updated>2020-02-24T21:26:49Z</updated>
<author>
<name>Jules Irenge</name>
</author>
<published>2020-02-23T23:16:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b77b4f634e5f7b0477e682ad643cbad43b7d9d93'/>
<id>urn:sha1:b77b4f634e5f7b0477e682ad643cbad43b7d9d93</id>
<content type='text'>
Sparse reports a warning at sctp_transport_walk_stop()

warning: context imbalance in sctp_transport_walk_stop
	- wrong count at exit

The root cause is the missing annotation at sctp_transport_walk_stop()
Add the missing __releases(RCU) annotation

Signed-off-by: Jules Irenge &lt;jbi.octave@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: Add missing annotation for sctp_transport_walk_start()</title>
<updated>2020-02-24T21:26:48Z</updated>
<author>
<name>Jules Irenge</name>
</author>
<published>2020-02-23T23:16:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6c72b7740c8665671c0d5d3001490c0e41939c1f'/>
<id>urn:sha1:6c72b7740c8665671c0d5d3001490c0e41939c1f</id>
<content type='text'>
Sparse reports a warning at sctp_transport_walk_start()

warning: context imbalance in sctp_transport_walk_start
	- wrong count at exit

The root cause is the missing annotation at sctp_transport_walk_start()
Add the missing __acquires(RCU) annotation

Signed-off-by: Jules Irenge &lt;jbi.octave@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: get netns from asoc and ep base</title>
<updated>2019-12-10T04:14:01Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2019-12-09T05:45:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4e7696d90b51a1a73ce0e8174f3aff58b914619c'/>
<id>urn:sha1:4e7696d90b51a1a73ce0e8174f3aff58b914619c</id>
<content type='text'>
Commit 312434617cb1 ("sctp: cache netns in sctp_ep_common") set netns
in asoc and ep base since they're created, and it will never change.
It's a better way to get netns from asoc and ep base, comparing to
calling sock_net().

This patch is to replace them.

v1-&gt;v2:
  - no change.

Suggested-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
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: port &lt; inet_prot_sock(net) --&gt; inet_port_requires_bind_service(net, port)</title>
<updated>2019-11-26T21:20:46Z</updated>
<author>
<name>Maciej Żenczykowski</name>
</author>
<published>2019-11-25T23:37:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=82f31ebf61bed3077c9935308e0a4b6c44842c5a'/>
<id>urn:sha1:82f31ebf61bed3077c9935308e0a4b6c44842c5a</id>
<content type='text'>
Note that the sysctl write accessor functions guarantee that:
  net-&gt;ipv4.sysctl_ip_prot_sock &lt;= net-&gt;ipv4.ip_local_ports.range[0]
invariant is maintained, and as such the max() in selinux hooks is actually spurious.

ie. even though
  if (snum &lt; max(inet_prot_sock(sock_net(sk)), low) || snum &gt; high) {
per logic is the same as
  if ((snum &lt; inet_prot_sock(sock_net(sk)) &amp;&amp; snum &lt; low) || snum &gt; high) {
it is actually functionally equivalent to:
  if (snum &lt; low || snum &gt; high) {
which is equivalent to:
  if (snum &lt; inet_prot_sock(sock_net(sk)) || snum &lt; low || snum &gt; high) {
even though the first clause is spurious.

But we want to hold on to it in case we ever want to change what what
inet_port_requires_bind_service() means (for example by changing
it from a, by default, [0..1024) range to some sort of set).

Test: builds, git 'grep inet_prot_sock' finds no other references
Cc: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: Maciej Żenczykowski &lt;maze@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
