01 Aug, 2020

2 commits

  • [ Upstream commit 3ecdda3e9ad837cf9cb41b6faa11b1af3a5abc0c ]

    When adding a stream with stream reconf, the new stream firstly is in
    CLOSED state but new out chunks can still be enqueued. Then once gets
    the confirmation from the peer, the state will change to OPEN.

    However, if the peer denies, it needs to roll back the stream. But when
    doing that, it only sets the stream outcnt back, and the chunks already
    in the new stream don't get purged. It caused these chunks can still be
    dequeued in sctp_outq_dequeue_data().

    As its stream is still in CLOSE, the chunk will be enqueued to the head
    again by sctp_outq_head_data(). This chunk will never be sent out, and
    the chunks after it can never be dequeued. The assoc will be 'hung' in
    a dead loop of sending this chunk.

    To fix it, this patch is to purge these chunks already in the new
    stream by calling sctp_stream_shrink_out() when failing to do the
    addstream reconf.

    Fixes: 11ae76e67a17 ("sctp: implement receiver-side procedures for the Reconf Response Parameter")
    Reported-by: Ying Xu
    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Xin Long
     
  • [ Upstream commit 8f13399db22f909a35735bf8ae2f932e0c8f0e30 ]

    It's not necessary to go list_for_each for outq->out_chunk_list
    when new outcnt >= old outcnt, as no chunk with higher sid than
    new (outcnt - 1) exists in the outqueue.

    While at it, also move the list_for_each code in a new function
    sctp_stream_shrink_out(), which will be used in the next patch.

    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Xin Long
     

05 Jan, 2020

1 commit

  • [ Upstream commit 61d5d4062876e21331c3d0ba4b02dbd50c06a658 ]

    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
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Marcelo Ricardo Leitner
     

31 Dec, 2019

1 commit

  • [ Upstream commit 951c6db954a1adefab492f6da805decacabbd1a7 ]

    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
    Tested-by: Xin Long
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Marcelo Ricardo Leitner
     

14 Aug, 2019

1 commit

  • 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
    Signed-off-by: zhengbin
    Acked-by: Marcelo Ricardo Leitner
    Acked-by: Neil Horman
    Signed-off-by: Jakub Kicinski

    zhengbin
     

02 Jul, 2019

1 commit

  • 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 ->ext pointer (allocated) in
    there, thus in a partially initialized state. On a subsequent call to
    sendmsg, it would notice the ->ext pointer in there, and trip on
    uninitialized stuff when trying to schedule the data chunk.

    The fix is undo the ->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
    Signed-off-by: Marcelo Ricardo Leitner
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Marcelo Ricardo Leitner
     

24 May, 2019

1 commit

  • 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
    Reviewed-by: Kate Stewart
    Reviewed-by: Richard Fontana
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190523091649.683323110@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

13 Mar, 2019

1 commit

  • 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
    Cc: Vlad Yasevich
    Cc: Neil Horman
    Cc: Marcelo Ricardo Leitner
    Cc: Alexey Dobriyan
    Cc: Al Viro
    Cc: Dave Hansen
    Cc: Eric Paris
    Cc: Matthew Wilcox
    Cc: Paul Moore
    Cc: Pravin B Shelar
    Cc: Shaohua Li
    Cc: Stephen Smalley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kent Overstreet
     

09 Mar, 2019

1 commit

  • syzbot reported a NULL-ptr deref caused by that sched->init() in
    sctp_stream_init() set stream->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->ext now, in sctp_stream_init()
    sctp_stream_alloc_out() will not change it, there's no need to
    call sched->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
    Acked-by: Neil Horman
    Acked-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Xin Long
     

14 Feb, 2019

1 commit

  • In sctp_stream_init(), after sctp_stream_outq_migrate() freed the
    surplus streams' ext, but sctp_stream_alloc_out() returns -ENOMEM,
    stream->outcnt will not be set to 'outcnt'.

    With the bigger value on stream->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
    Acked-by: Neil Horman
    Acked-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Xin Long
     

04 Feb, 2019

1 commit

  • Now when using stream reconfig to add out streams, stream->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->out_curr updated, next time when trying to
    send from stream->out_curr stream, a panic would be caused.

    This patch is to check and update stream->out_curr when
    allocating stream_out.

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

    Fixes: 5bbbbe32a431 ("sctp: introduce stream scheduler foundations")
    Reported-by: Ying Xu
    Reported-by: syzbot+e33a3a138267ca119c7d@syzkaller.appspotmail.com
    Signed-off-by: Xin Long
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Xin Long
     

25 Jan, 2019

2 commits

  • 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
    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller

    Xin Long
     
  • This patch is to improve sctp stream reset events in 4 places:

    1. In sctp_process_strreset_outreq(), the flag should always be set with
    SCTP_STREAM_RESET_INCOMING_SSN instead of OUTGOING, as receiver's in
    stream is reset here.
    2. In sctp_process_strreset_outreq(), move up SCTP_STRRESET_ERR_WRONG_SSN
    check, as the reset has to succeed after reconf_timer stops for the
    in stream reset request retransmission.
    3. In sctp_process_strreset_inreq(), no event should be sent, as no in
    or out stream is reset here.
    4. In sctp_process_strreset_resp(), SCTP_STREAM_RESET_INCOMING_SSN or
    OUTGOING event should always be sent for stream reset requests, no
    matter it fails or succeeds to process the request.

    Fixes: 810544764536 ("sctp: implement receiver-side procedures for the Outgoing SSN Reset Request Parameter")
    Fixes: 16e1a91965b0 ("sctp: implement receiver-side procedures for the Incoming SSN Reset Request Parameter")
    Fixes: 11ae76e67a17 ("sctp: implement receiver-side procedures for the Reconf Response Parameter")
    Reported-by: Ying Xu
    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller

    Xin Long
     

20 Nov, 2018

1 commit

  • Different from processing the addstrm_out request, The receiver handles
    an addstrm_in request by sending back an addstrm_out request to the
    sender who will increase its stream's in and incnt later.

    Now stream->incnt has been increased since it sent out the addstrm_in
    request in sctp_send_add_streams(), with the wrong stream->incnt will
    even cause crash when copying stream info from the old stream's in to
    the new one's in sctp_process_strreset_addstrm_out().

    This patch is to fix it by simply removing the stream->incnt change
    from sctp_send_add_streams().

    Fixes: 242bd2d519d7 ("sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Request Parameter")
    Reported-by: Jianwen Ji
    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller

    Xin Long
     

12 Aug, 2018

2 commits


28 Apr, 2018

1 commit

  • 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->outcnt is not
    cleared while stream->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
    Signed-off-by: Xin Long
    Acked-by: Neil Horman
    Acked-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Xin Long
     

15 Feb, 2018

1 commit

  • This patch is to fix the file comments in stream.c and
    stream_interleave.c

    v1->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
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Xin Long
     

09 Jan, 2018

1 commit


04 Jan, 2018

1 commit

  • 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->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
    Fixes: f952be79cebd ("sctp: introduce struct sctp_stream_out_ext")
    Signed-off-by: Marcelo Ricardo Leitner
    Reviewed-by: Xin Long
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Marcelo Ricardo Leitner
     

16 Dec, 2017

2 commits

  • 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
    Acked-by: Marcelo R. Leitner
    Signed-off-by: David S. Miller

    Xin Long
     
  • 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
    Acked-by: Marcelo R. Leitner
    Signed-off-by: David S. Miller

    Xin Long
     

12 Dec, 2017

1 commit

  • 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->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->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
    Acked-by: Marcelo Ricardo Leitner
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Xin Long
     

29 Nov, 2017

1 commit


27 Nov, 2017

5 commits

  • When doing asoc reset, if the sender of the response has already sent some
    chunk and increased asoc->next_tsn before the duplicate request comes, the
    response will use the old result with an incorrect sender next_tsn.

    Better than asoc->next_tsn, asoc->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->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
    Acked-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Xin Long
     
  • 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
    Acked-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Xin Long
     
  • As it says in rfc6525#section5.1.4, before sending the request,

    C2: The sender has either no outstanding TSNs or considers all
    outstanding TSNs abandoned.

    Prior to this patch, it tried to consider all outstanding TSNs abandoned
    by dropping all chunks in all outqs with sctp_outq_free (even including
    sacked, retransmit and transmitted queues) when doing this reset, which
    is too aggressive.

    To make it work gently, this patch will only allow the asoc reset when
    the sender has no outstanding TSNs by checking if unsent, transmitted
    and retransmit are all empty with sctp_outq_is_empty before sending
    and processing the request.

    Fixes: 692787cef651 ("sctp: implement receiver-side procedures for the SSN/TSN Reset Request Parameter")
    Signed-off-by: Xin Long
    Acked-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Xin Long
     
  • Now the out stream reset in sctp stream reconf could be done even if
    the stream outq is not empty. It means that users can not be sure
    since which msg the new ssn will be used.

    To make this more synchronous, it shouldn't allow to do out stream
    reset until these chunks in unsent outq all are sent out.

    This patch checks the corresponding stream outqs when sending and
    processing the request . If any of them has unsent chunks in outq,
    it will return -EAGAIN instead or send SCTP_STRRESET_IN_PROGRESS
    back to the sender.

    Fixes: 7f9d68ac944e ("sctp: implement sender-side procedures for SSN Reset Request Parameter")
    Suggested-by: Marcelo Ricardo Leitner
    Signed-off-by: Xin Long
    Acked-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Xin Long
     
  • Now in stream reconf part there are still some places using magic
    number 2 for each stream number length. To make it more readable,
    this patch is to replace them with sizeof(__u16).

    Reported-by: Marcelo Ricardo Leitner
    Signed-off-by: Xin Long
    Acked-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Xin Long
     

16 Nov, 2017

1 commit

  • Now when resetting stream, if both in and out flags are set, the info
    len can reach:
    sizeof(struct sctp_strreset_outreq) + SCTP_MAX_STREAM(65535) +
    sizeof(struct sctp_strreset_inreq) + SCTP_MAX_STREAM(65535)
    even without duplicated stream no, this value is far greater than the
    chunk's max size.

    _sctp_make_chunk doesn't do any check for this, which would cause the
    skb it allocs is huge, syzbot even reported a crash due to this.

    This patch is to check stream reset info len before making reconf
    chunk and return EINVAL if the len exceeds chunk's capacity.

    Thanks Marcelo and Neil for making this clear.

    v1->v2:
    - move the check into sctp_send_reset_streams instead.

    Fixes: cc16f00f6529 ("sctp: add support for generating stream reconf ssn reset request chunk")
    Reported-by: Dmitry Vyukov
    Signed-off-by: Xin Long
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Xin Long
     

01 Nov, 2017

1 commit

  • Fix to returnerror code -ENOMEM from the sctp_make_strreset_addstrm()
    error handling case instead of 0. 'retval' can be overwritten to 0 after
    call sctp_stream_alloc_out().

    Fixes: e090abd0d81c ("sctp: factor out stream->out allocation")
    Signed-off-by: Wei Yongjun
    Acked-by: Marcelo Ricardo Leitner
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Wei Yongjun
     

30 Oct, 2017

1 commit

  • Several conflicts here.

    NFP driver bug fix adding nfp_netdev_is_nfp_repr() check to
    nfp_fl_output() needed some adjustments because the code block is in
    an else block now.

    Parallel additions to net/pkt_cls.h and net/sch_generic.h

    A bug fix in __tcp_retransmit_skb() conflicted with some of
    the rbtree changes in net-next.

    The tc action RCU callback fixes in 'net' had some overlap with some
    of the recent tcf_block reworking.

    Signed-off-by: David S. Miller

    David S. Miller
     

29 Oct, 2017

1 commit

  • These warnings were found by running 'make C=2 M=net/sctp/'.

    They are introduced by not aware of Endian when coding stream
    reconf patches.

    Since commit c0d8bab6ae51 ("sctp: add get and set sockopt for
    reconf_enable") enabled stream reconf feature for users, the
    Fixes tag below would use it.

    Fixes: c0d8bab6ae51 ("sctp: add get and set sockopt for reconf_enable")
    Reported-by: Eric Dumazet
    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller

    Xin Long
     

04 Oct, 2017

5 commits

  • This patch introduces the hooks necessary to do stream scheduling, as
    per RFC Draft ndata. It also introduces the first scheduler, which is
    what we do today but now factored out: first come first served (FCFS).

    With stream scheduling now we have to track which chunk was enqueued on
    which stream and be able to select another other than the in front of
    the main outqueue. So we introduce a list on sctp_stream_out_ext
    structure for this purpose.

    We reuse sctp_chunk->transmitted_list space for the list above, as the
    chunk cannot belong to the two lists at the same time. By using the
    union in there, we can have distinct names for these moments.

    sctp_sched_ops are the operations expected to be implemented by each
    scheduler. The dequeueing is a bit particular to this implementation but
    it is to match how we dequeue packets today. We first dequeue and then
    check if it fits the packet and if not, we requeue it at head. Thus why
    we don't have a peek operation but have dequeue_done instead, which is
    called once the chunk can be safely considered as transmitted.

    The check removed from sctp_outq_flush is now performed by
    sctp_stream_outq_migrate, which is only called during assoc setup.
    (sctp_sendmsg() also checks for it)

    The only operation that is foreseen but not yet added here is a way to
    signalize that a new packet is starting or that the packet is done, for
    round robin scheduler per packet, but is intentionally left to the
    patch that actually implements it.

    Support for I-DATA chunks, also described in this RFC, with user message
    interleaving is straightforward as it just requires the schedulers to
    probe for the feature and ignore datamsg boundaries when dequeueing.

    See-also: https://tools.ietf.org/html/draft-ietf-tsvwg-sctp-ndata-13
    Tested-by: Xin Long
    Signed-off-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Marcelo Ricardo Leitner
     
  • With the stream schedulers, sctp_stream_out will become too big to be
    allocated by kmalloc and as we need to allocate with BH disabled, we
    cannot use __vmalloc in sctp_stream_init().

    This patch moves out the stats from sctp_stream_out to
    sctp_stream_out_ext, which will be allocated only when the application
    tries to sendmsg something on it.

    Just the introduction of sctp_stream_out_ext would already fix the issue
    described above by splitting the allocation in two. Moving the stats
    to it also reduces the pressure on the allocator as we will ask for less
    memory atomically when creating the socket and we will use GFP_KERNEL
    later.

    Then, for stream schedulers, we will just use sctp_stream_out_ext.

    Tested-by: Xin Long
    Signed-off-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Marcelo Ricardo Leitner
     
  • There is 1 place allocating it and another reallocating. Move such
    procedures to a common function.

    v2: updated changelog

    Tested-by: Xin Long
    Signed-off-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Marcelo Ricardo Leitner
     
  • There is 1 place allocating it and 2 other reallocating. Move such
    procedures to a common function.

    Tested-by: Xin Long
    Signed-off-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Marcelo Ricardo Leitner
     
  • As SCTP supports up to 65535 streams, that can lead to very large
    allocations in sctp_stream_init(). As Xin Long noticed, systems with
    small amounts of memory are more prone to not have enough memory and
    dump warnings on dmesg initiated by user actions. Thus, silence them.

    Also, if the reallocation of stream->out is not necessary, skip it and
    keep the memory we already have.

    Reported-by: Xin Long
    Tested-by: Xin Long
    Signed-off-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Marcelo Ricardo Leitner
     

02 Jul, 2017

1 commit

  • This patch is to remove the typedef sctp_paramhdr_t, and replace
    with struct sctp_paramhdr in the places where it's using this
    typedef.

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

    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller

    Xin Long
     

03 Jun, 2017

1 commit

  • Since last patch, sctp doesn't need to alloc memory for asoc->stream any
    more. sctp_stream_new and sctp_stream_init both are used to alloc memory
    for stream.in or stream.out, and their names are also confusing.

    This patch is to merge them into sctp_stream_init, and only pass stream
    and streamcnt parameters into it, instead of the whole asoc.

    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller

    Xin Long