<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/net/sctp/stream.c, branch linux-4.17.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.17.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.17.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2018-04-27T17:34:34Z</updated>
<entry>
<title>sctp: clear the new asoc's stream outcnt in sctp_stream_update</title>
<updated>2018-04-27T17:34:34Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2018-04-26T07:21:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6a9a27d5397fc6c52f90c09ddab91e65053584aa'/>
<id>urn:sha1:6a9a27d5397fc6c52f90c09ddab91e65053584aa</id>
<content type='text'>
When processing a duplicate cookie-echo chunk, sctp moves the new
temp asoc's stream out/in into the old asoc, and later frees this
new temp asoc.

But now after this move, the new temp asoc's stream-&gt;outcnt is not
cleared while stream-&gt;out is set to NULL, which would cause a same
crash as the one fixed in Commit 79d0895140e9 ("sctp: fix error
path in sctp_stream_init") when freeing this asoc later.

This fix is to clear this outcnt in sctp_stream_update.

Fixes: f952be79cebd ("sctp: introduce struct sctp_stream_out_ext")
Reported-by: Jianwen Ji &lt;jiji@redhat.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>sctp: fix some copy-paste errors for file comments</title>
<updated>2018-02-14T19:18:32Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2018-02-13T11:29:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fae8b6f4a6be42372f8b7ffda39c3ca2cd951dc1'/>
<id>urn:sha1:fae8b6f4a6be42372f8b7ffda39c3ca2cd951dc1</id>
<content type='text'>
This patch is to fix the file comments in stream.c and
stream_interleave.c

v1-&gt;v2:
  rephrase the comment for stream.c according to Neil's suggestion.

Fixes: a83863174a61 ("sctp: prepare asoc stream for stream reconf")
Fixes: 0c3f6f655487 ("sctp: implement make_datafrag for sctp_stream_interleave")
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>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2018-01-09T15:37:00Z</updated>
<author>
<name>David S. Miller</name>
</author>
<published>2018-01-09T15:37:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a0ce093180f2bbb832b3f5583adc640ad67ea568'/>
<id>urn:sha1:a0ce093180f2bbb832b3f5583adc640ad67ea568</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sctp: fix error path in sctp_stream_init</title>
<updated>2018-01-03T16:29:42Z</updated>
<author>
<name>Marcelo Ricardo Leitner</name>
</author>
<published>2018-01-02T21:44:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=79d0895140e937ba111e6420b4cd83ee75efa788'/>
<id>urn:sha1:79d0895140e937ba111e6420b4cd83ee75efa788</id>
<content type='text'>
syzbot noticed a NULL pointer dereference panic in sctp_stream_free()
which was caused by an incomplete error handling in sctp_stream_init().
By not clearing stream-&gt;outcnt, it made a for() in sctp_stream_free()
think that it had elements to free, but not, leading to the panic.

As suggested by Xin Long, this patch also simplifies the error path by
moving it to the only if() that uses it.

See-also: https://www.spinics.net/lists/netdev/msg473756.html
See-also: https://www.spinics.net/lists/netdev/msg465024.html
Reported-by: syzbot &lt;syzkaller@googlegroups.com&gt;
Fixes: f952be79cebd ("sctp: introduce struct sctp_stream_out_ext")
Signed-off-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Reviewed-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: update mid instead of ssn when doing stream and asoc reset</title>
<updated>2017-12-15T18:52:22Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2017-12-14T16:41:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=107e242569541795a84264f94375e987ba04d309'/>
<id>urn:sha1:107e242569541795a84264f94375e987ba04d309</id>
<content type='text'>
When using idata and doing stream and asoc reset, setting ssn with
0 could only clear the 1st 16 bits of mid.

So to make this work for both data and idata, it sets mid with 0
instead of ssn, and also mid_uo for unordered idata also need to
be cleared, as said in section 2.3.2 of RFC8260.

Signed-off-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Acked-by: Marcelo R. Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: implement report_ftsn for sctp_stream_interleave</title>
<updated>2017-12-15T18:52:22Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2017-12-14T16:41:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=47b20a88566f89dd0cc80c46f59ce0a12259d404'/>
<id>urn:sha1:47b20a88566f89dd0cc80c46f59ce0a12259d404</id>
<content type='text'>
report_ftsn is added as a member of sctp_stream_interleave, used to
skip tsn from tsnmap, remove old events from reasm or lobby queue,
and abort pd for data or idata, called for SCTP_CMD_REPORT_FWDTSN
cmd and asoc reset.

sctp_report_iftsn works for ifwdtsn, and sctp_report_fwdtsn works
for fwdtsn. Note that sctp_report_iftsn doesn't do asoc abort_pd,
as stream abort_pd will be done when handling ifwdtsn. But when
ftsn is equal with ftsn, which means asoc reset, asoc abort_pd has
to be done.

Signed-off-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Acked-by: Marcelo R. Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: implement make_datafrag for sctp_stream_interleave</title>
<updated>2017-12-11T16:23:04Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2017-12-08T13:04:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0c3f6f655487d12c7a0c16914c98c599043e88d3'/>
<id>urn:sha1:0c3f6f655487d12c7a0c16914c98c599043e88d3</id>
<content type='text'>
To avoid hundreds of checks for the different process on I-DATA chunk,
struct sctp_stream_interleave is defined as a group of functions used
to replace the codes in some place where it needs to do different job
according to if the asoc intl_enabled is set.

With these ops, it only needs to initialize asoc-&gt;stream.si with
sctp_stream_interleave_0 for normal data if asoc intl_enable is 0,
or sctp_stream_interleave_1 for idata if asoc intl_enable is set in
sctp_stream_init.

After that, the members in asoc-&gt;stream.si can be used directly in
some special places without checking asoc intl_enable.

make_datafrag is the first member for sctp_stream_interleave, it's
used to make data or idata frags, called in sctp_datamsg_from_user.
The old function sctp_make_datafrag_empty needs to be adjust some
to fit in this ops.

Note that as idata and data chunks have different length, it also
defines data_chunk_len for sctp_stream_interleave to describe the
chunk size.

Signed-off-by: Xin Long &lt;lucien.xin@gmail.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: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: force SCTP_ERROR_INV_STRM with __u32 when calling sctp_chunk_fail</title>
<updated>2017-11-28T16:00:13Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2017-11-26T12:16:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=08f46070dde2a835a7a5bfd4c70372c27bff5d88'/>
<id>urn:sha1:08f46070dde2a835a7a5bfd4c70372c27bff5d88</id>
<content type='text'>
This patch is to force SCTP_ERROR_INV_STRM with right type to
fit in sctp_chunk_fail to avoid the sparse error.

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;
</content>
</entry>
<entry>
<title>sctp: set sender next_tsn for the old result with ctsn_ack_point plus 1</title>
<updated>2017-11-27T15:38:45Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2017-11-25T13:05:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=52a395896a051a3d5c34fba67c324f69ec5e67c6'/>
<id>urn:sha1:52a395896a051a3d5c34fba67c324f69ec5e67c6</id>
<content type='text'>
When doing asoc reset, if the sender of the response has already sent some
chunk and increased asoc-&gt;next_tsn before the duplicate request comes, the
response will use the old result with an incorrect sender next_tsn.

Better than asoc-&gt;next_tsn, asoc-&gt;ctsn_ack_point can't be changed after
the sender of the response has performed the asoc reset and before the
peer has confirmed it, and it's value is still asoc-&gt;next_tsn original
value minus 1.

This patch sets sender next_tsn for the old result with ctsn_ack_point
plus 1 when processing the duplicate request, to make sure the sender
next_tsn value peer gets will be always right.

Fixes: 692787cef651 ("sctp: implement receiver-side procedures for the SSN/TSN Reset Request Parameter")
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;
</content>
</entry>
<entry>
<title>sctp: avoid flushing unsent queue when doing asoc reset</title>
<updated>2017-11-27T15:38:45Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2017-11-25T13:05:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=159f2a7456c6ae95c1e1a58e8b8ec65ef12d51cf'/>
<id>urn:sha1:159f2a7456c6ae95c1e1a58e8b8ec65ef12d51cf</id>
<content type='text'>
Now when doing asoc reset, it cleans up sacked and abandoned queues
by calling sctp_outq_free where it also cleans up unsent, retransmit
and transmitted queues.

It's safe for the sender of response, as these 3 queues are empty at
that time. But when the receiver of response is doing the reset, the
users may already enqueue some chunks into unsent during the time
waiting the response, and these chunks should not be flushed.

To void the chunks in it would be removed, it moves the queue into a
temp list, then gets it back after sctp_outq_free is done.

The patch also fixes some incorrect comments in
sctp_process_strreset_tsnreq.

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;
</content>
</entry>
</feed>
