<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/net/sctp/stream.c, branch linux-5.5.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.5.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.5.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2019-12-25T00:07:10Z</updated>
<entry>
<title>sctp: fix err handling of stream initialization</title>
<updated>2019-12-25T00:07:10Z</updated>
<author>
<name>Marcelo Ricardo Leitner</name>
</author>
<published>2019-12-20T18:03:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=61d5d4062876e21331c3d0ba4b02dbd50c06a658'/>
<id>urn:sha1:61d5d4062876e21331c3d0ba4b02dbd50c06a658</id>
<content type='text'>
The fix on 951c6db954a1 fixed the issued reported there but introduced
another. When the allocation fails within sctp_stream_init() it is
okay/necessary to free the genradix. But it is also called when adding
new streams, from sctp_send_add_streams() and
sctp_process_strreset_addstrm_in() and in those situations it cannot
just free the genradix because by then it is a fully operational
association.

The fix here then is to only free the genradix in sctp_stream_init()
and on those other call sites  move on with what it already had and let
the subsequent error handling to handle it.

Tested with the reproducers from this report and the previous one,
with lksctp-tools and sctp-tests.

Reported-by: syzbot+9a1bc632e78a1a98488b@syzkaller.appspotmail.com
Fixes: 951c6db954a1 ("sctp: fix memleak on err handling of stream initialization")
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 memleak on err handling of stream initialization</title>
<updated>2019-12-18T05:58:37Z</updated>
<author>
<name>Marcelo Ricardo Leitner</name>
</author>
<published>2019-12-17T01:01:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=951c6db954a1adefab492f6da805decacabbd1a7'/>
<id>urn:sha1:951c6db954a1adefab492f6da805decacabbd1a7</id>
<content type='text'>
syzbot reported a memory leak when an allocation fails within
genradix_prealloc() for output streams. That's because
genradix_prealloc() leaves initialized members initialized when the
issue happens and SCTP stack will abort the current initialization but
without cleaning up such members.

The fix here is to always call genradix_free() when genradix_prealloc()
fails, for output and also input streams, as it suffers from the same
issue.

Reported-by: syzbot+772d9e36c490b18d51d1@syzkaller.appspotmail.com
Fixes: 2075e50caf5e ("sctp: convert to genradix")
Signed-off-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Tested-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: fix memleak in sctp_send_reset_streams</title>
<updated>2019-08-14T03:45:01Z</updated>
<author>
<name>zhengbin</name>
</author>
<published>2019-08-13T14:05:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6d5afe20397b478192ed8c38ec0ee10fa3aec649'/>
<id>urn:sha1:6d5afe20397b478192ed8c38ec0ee10fa3aec649</id>
<content type='text'>
If the stream outq is not empty, need to kfree nstr_list.

Fixes: d570a59c5b5f ("sctp: only allow the out stream reset when the stream outq is empty")
Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: zhengbin &lt;zhengbin13@huawei.com&gt;
Acked-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Acked-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Signed-off-by: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
</content>
</entry>
<entry>
<title>sctp: fix error handling on stream scheduler initialization</title>
<updated>2019-07-02T02:01:47Z</updated>
<author>
<name>Marcelo Ricardo Leitner</name>
</author>
<published>2019-06-27T22:48:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4d1415811e492d9a8238f8a92dd0d51612c788e9'/>
<id>urn:sha1:4d1415811e492d9a8238f8a92dd0d51612c788e9</id>
<content type='text'>
It allocates the extended area for outbound streams only on sendmsg
calls, if they are not yet allocated.  When using the priority
stream scheduler, this initialization may imply into a subsequent
allocation, which may fail.  In this case, it was aborting the stream
scheduler initialization but leaving the -&gt;ext pointer (allocated) in
there, thus in a partially initialized state.  On a subsequent call to
sendmsg, it would notice the -&gt;ext pointer in there, and trip on
uninitialized stuff when trying to schedule the data chunk.

The fix is undo the -&gt;ext initialization if the stream scheduler
initialization fails and avoid the partially initialized state.

Although syzkaller bisected this to commit 4ff40b86262b ("sctp: set
chunk transport correctly when it's a new asoc"), this bug was actually
introduced on the commit I marked below.

Reported-by: syzbot+c1a380d42b190ad1e559@syzkaller.appspotmail.com
Fixes: 5bbbbe32a431 ("sctp: introduce stream scheduler foundations")
Tested-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Signed-off-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Acked-by: Neil Horman &lt;nhorman@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 104</title>
<updated>2019-05-24T15:39:00Z</updated>
<author>
<name>Thomas Gleixner</name>
</author>
<published>2019-05-23T09:14:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.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: convert to genradix</title>
<updated>2019-03-12T17:04:02Z</updated>
<author>
<name>Kent Overstreet</name>
</author>
<published>2019-03-12T06:31:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2075e50caf5ea28be3cba0d01b3058bb5c3b0168'/>
<id>urn:sha1:2075e50caf5ea28be3cba0d01b3058bb5c3b0168</id>
<content type='text'>
This also makes sctp_stream_alloc_(out|in) saner, in that they no longer
allocate new flex_arrays/genradixes, they just preallocate more
elements.

This code does however have a suspicious lack of locking.

Link: http://lkml.kernel.org/r/20181217131929.11727-7-kent.overstreet@gmail.com
Signed-off-by: Kent Overstreet &lt;kent.overstreet@gmail.com&gt;
Cc: Vlad Yasevich &lt;vyasevich@gmail.com&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Cc: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Cc: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Dave Hansen &lt;dave.hansen@intel.com&gt;
Cc: Eric Paris &lt;eparis@parisplace.org&gt;
Cc: Matthew Wilcox &lt;willy@infradead.org&gt;
Cc: Paul Moore &lt;paul@paul-moore.com&gt;
Cc: Pravin B Shelar &lt;pshelar@ovn.org&gt;
Cc: Shaohua Li &lt;shli@kernel.org&gt;
Cc: Stephen Smalley &lt;sds@tycho.nsa.gov&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>sctp: remove sched init from sctp_stream_init</title>
<updated>2019-03-08T19:24:33Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2019-03-08T07:49:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2e990dfd13974d9eae493006f42ffb48707970ef'/>
<id>urn:sha1:2e990dfd13974d9eae493006f42ffb48707970ef</id>
<content type='text'>
syzbot reported a NULL-ptr deref caused by that sched-&gt;init() in
sctp_stream_init() set stream-&gt;rr_next = NULL.

  kasan: GPF could be caused by NULL-ptr deref or user memory access
  RIP: 0010:sctp_sched_rr_dequeue+0xd3/0x170 net/sctp/stream_sched_rr.c:141
  Call Trace:
    sctp_outq_dequeue_data net/sctp/outqueue.c:90 [inline]
    sctp_outq_flush_data net/sctp/outqueue.c:1079 [inline]
    sctp_outq_flush+0xba2/0x2790 net/sctp/outqueue.c:1205

All sched info is saved in sout-&gt;ext now, in sctp_stream_init()
sctp_stream_alloc_out() will not change it, there's no need to
call sched-&gt;init() again, since sctp_outq_init() has already
done it.

Fixes: 5bbbbe32a431 ("sctp: introduce stream scheduler foundations")
Reported-by: syzbot+4c9934f20522c0efd657@syzkaller.appspotmail.com
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>sctp: set stream ext to NULL after freeing it in sctp_stream_outq_migrate</title>
<updated>2019-02-14T00:33:44Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2019-02-12T10:51:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=af98c5a78517c04adb5fd68bb64b1ad6fe3d473f'/>
<id>urn:sha1:af98c5a78517c04adb5fd68bb64b1ad6fe3d473f</id>
<content type='text'>
In sctp_stream_init(), after sctp_stream_outq_migrate() freed the
surplus streams' ext, but sctp_stream_alloc_out() returns -ENOMEM,
stream-&gt;outcnt will not be set to 'outcnt'.

With the bigger value on stream-&gt;outcnt, when closing the assoc and
freeing its streams, the ext of those surplus streams will be freed
again since those stream exts were not set to NULL after freeing in
sctp_stream_outq_migrate(). Then the invalid-free issue reported by
syzbot would be triggered.

We fix it by simply setting them to NULL after freeing.

Fixes: 5bbbbe32a431 ("sctp: introduce stream scheduler foundations")
Reported-by: syzbot+58e480e7b28f2d890bfd@syzkaller.appspotmail.com
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>sctp: check and update stream-&gt;out_curr when allocating stream_out</title>
<updated>2019-02-03T22:27:47Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2019-02-03T19:27:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cfe4bd7a257f6d6f81d3458d8c9d9ec4957539e6'/>
<id>urn:sha1:cfe4bd7a257f6d6f81d3458d8c9d9ec4957539e6</id>
<content type='text'>
Now when using stream reconfig to add out streams, stream-&gt;out
will get re-allocated, and all old streams' information will
be copied to the new ones and the old ones will be freed.

So without stream-&gt;out_curr updated, next time when trying to
send from stream-&gt;out_curr stream, a panic would be caused.

This patch is to check and update stream-&gt;out_curr when
allocating stream_out.

v1-&gt;v2:
  - define fa_index() to get elem index from stream-&gt;out_curr.
v2-&gt;v3:
  - repost with no change.

Fixes: 5bbbbe32a431 ("sctp: introduce stream scheduler foundations")
Reported-by: Ying Xu &lt;yinxu@redhat.com&gt;
Reported-by: syzbot+e33a3a138267ca119c7d@syzkaller.appspotmail.com
Signed-off-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Acked-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: improve the events for sctp stream adding</title>
<updated>2019-01-25T02:13:57Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2019-01-21T18:40:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8220c870cb0f4eaa4e335c9645dbd9a1c461c1dd'/>
<id>urn:sha1:8220c870cb0f4eaa4e335c9645dbd9a1c461c1dd</id>
<content type='text'>
This patch is to improve sctp stream adding events in 2 places:

  1. In sctp_process_strreset_addstrm_out(), move up SCTP_MAX_STREAM
     and in stream allocation failure checks, as the adding has to
     succeed after reconf_timer stops for the in stream adding
     request retransmission.

  3. In sctp_process_strreset_addstrm_in(), no event should be sent,
     as no in or out stream is added here.

Fixes: 50a41591f110 ("sctp: implement receiver-side procedures for the Add Outgoing Streams Request Parameter")
Fixes: c5c4ebb3ab87 ("sctp: implement receiver-side procedures for the Add Incoming Streams Request Parameter")
Reported-by: Ying Xu &lt;yinxu@redhat.com&gt;
Signed-off-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
