1. 05 5月, 2019 1 次提交
    • X
      sctp: avoid running the sctp state machine recursively · b563e9bb
      Xin Long 提交于
      [ Upstream commit fbd019737d71e405f86549fd738f81e2ff3dd073 ]
      
      Ying triggered a call trace when doing an asconf testing:
      
        BUG: scheduling while atomic: swapper/12/0/0x10000100
        Call Trace:
         <IRQ>  [<ffffffffa4375904>] dump_stack+0x19/0x1b
         [<ffffffffa436fcaf>] __schedule_bug+0x64/0x72
         [<ffffffffa437b93a>] __schedule+0x9ba/0xa00
         [<ffffffffa3cd5326>] __cond_resched+0x26/0x30
         [<ffffffffa437bc4a>] _cond_resched+0x3a/0x50
         [<ffffffffa3e22be8>] kmem_cache_alloc_node+0x38/0x200
         [<ffffffffa423512d>] __alloc_skb+0x5d/0x2d0
         [<ffffffffc0995320>] sctp_packet_transmit+0x610/0xa20 [sctp]
         [<ffffffffc098510e>] sctp_outq_flush+0x2ce/0xc00 [sctp]
         [<ffffffffc098646c>] sctp_outq_uncork+0x1c/0x20 [sctp]
         [<ffffffffc0977338>] sctp_cmd_interpreter.isra.22+0xc8/0x1460 [sctp]
         [<ffffffffc0976ad1>] sctp_do_sm+0xe1/0x350 [sctp]
         [<ffffffffc099443d>] sctp_primitive_ASCONF+0x3d/0x50 [sctp]
         [<ffffffffc0977384>] sctp_cmd_interpreter.isra.22+0x114/0x1460 [sctp]
         [<ffffffffc0976ad1>] sctp_do_sm+0xe1/0x350 [sctp]
         [<ffffffffc097b3a4>] sctp_assoc_bh_rcv+0xf4/0x1b0 [sctp]
         [<ffffffffc09840f1>] sctp_inq_push+0x51/0x70 [sctp]
         [<ffffffffc099732b>] sctp_rcv+0xa8b/0xbd0 [sctp]
      
      As it shows, the first sctp_do_sm() running under atomic context (NET_RX
      softirq) invoked sctp_primitive_ASCONF() that uses GFP_KERNEL flag later,
      and this flag is supposed to be used in non-atomic context only. Besides,
      sctp_do_sm() was called recursively, which is not expected.
      
      Vlad tried to fix this recursive call in Commit c0786693 ("sctp: Fix
      oops when sending queued ASCONF chunks") by introducing a new command
      SCTP_CMD_SEND_NEXT_ASCONF. But it didn't work as this command is still
      used in the first sctp_do_sm() call, and sctp_primitive_ASCONF() will
      be called in this command again.
      
      To avoid calling sctp_do_sm() recursively, we send the next queued ASCONF
      not by sctp_primitive_ASCONF(), but by sctp_sf_do_prm_asconf() in the 1st
      sctp_do_sm() directly.
      Reported-by: NYing Xu <yinxu@redhat.com>
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Acked-by: NNeil Horman <nhorman@tuxdriver.com>
      Acked-by: NMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b563e9bb
  2. 08 5月, 2018 1 次提交
    • X
      sctp: delay the authentication for the duplicated cookie-echo chunk · 59d8d443
      Xin Long 提交于
      Now sctp only delays the authentication for the normal cookie-echo
      chunk by setting chunk->auth_chunk in sctp_endpoint_bh_rcv(). But
      for the duplicated one with auth, in sctp_assoc_bh_rcv(), it does
      authentication first based on the old asoc, which will definitely
      fail due to the different auth info in the old asoc.
      
      The duplicated cookie-echo chunk will create a new asoc with the
      auth info from this chunk, and the authentication should also be
      done with the new asoc's auth info for all of the collision 'A',
      'B' and 'D'. Otherwise, the duplicated cookie-echo chunk with auth
      will never pass the authentication and create the new connection.
      
      This issue exists since very beginning, and this fix is to make
      sctp_assoc_bh_rcv() follow the way sctp_endpoint_bh_rcv() does
      for the normal cookie-echo chunk to delay the authentication.
      
      While at it, remove the unused params from sctp_sf_authenticate()
      and define sctp_auth_chunk_verify() used for all the places that
      do the delayed authentication.
      
      v1->v2:
        fix the typo in changelog as Marcelo noticed.
      Acked-by: NMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Acked-by: NNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      59d8d443
  3. 02 5月, 2018 2 次提交
  4. 15 3月, 2018 3 次提交
  5. 27 2月, 2018 1 次提交
  6. 03 1月, 2018 1 次提交
    • M
      net: sctp: Add SCTP ACK tracking trace event · 103d750c
      Masami Hiramatsu 提交于
      Add SCTP ACK tracking trace event to trace the changes of SCTP
      association state in response to incoming packets.
      It is used for debugging SCTP congestion control algorithms,
      and will replace sctp_probe module.
      
      Note that this event a bit tricky. Since this consists of 2
      events (sctp_probe and sctp_probe_path) so you have to enable
      both events as below.
      
        # cd /sys/kernel/debug/tracing
        # echo 1 > events/sctp/sctp_probe/enable
        # echo 1 > events/sctp/sctp_probe_path/enable
      
      Or, you can enable all the events under sctp.
      
        # echo 1 > events/sctp/enable
      
      Since sctp_probe_path event is always invoked from sctp_probe
      event, you can not see any output if you only enable
      sctp_probe_path.
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      103d750c
  7. 16 12月, 2017 1 次提交
    • X
      sctp: implement validate_ftsn for sctp_stream_interleave · 0fc2ea92
      Xin Long 提交于
      validate_ftsn is added as a member of sctp_stream_interleave, used to
      validate ssn/chunk type for fwdtsn or mid (message id)/chunk type for
      ifwdtsn, called in sctp_sf_eat_fwd_tsn, just as validate_data.
      
      If this check fails, an abort packet will be sent, as said in section
      2.3.1 of RFC8260.
      
      As ifwdtsn and fwdtsn chunks have different length, it also defines
      ftsn_chunk_len for sctp_stream_interleave to describe the chunk size.
      Then it replaces all sizeof(struct sctp_fwdtsn_chunk) with
      sctp_ftsnchk_len.
      
      It also adds the process for ifwdtsn in rx path. As Marcelo pointed
      out, there's no need to add event table for ifwdtsn, but just share
      prsctp_chunk_event_table with fwdtsn's. It would drop fwdtsn chunk
      for ifwdtsn and drop ifwdtsn chunk for fwdtsn by calling validate_ftsn
      in sctp_sf_eat_fwd_tsn.
      
      After this patch, the ifwdtsn can be accepted.
      
      Note that this patch also removes the sctp.intl_enable check for
      idata chunks in sctp_chunk_event_lookup, as it will do this check
      in validate_data later.
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Acked-by: NMarcelo R. Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0fc2ea92
  8. 12 12月, 2017 1 次提交
  9. 12 8月, 2017 5 次提交
  10. 07 8月, 2017 2 次提交
  11. 04 8月, 2017 11 次提交
  12. 25 7月, 2017 7 次提交
  13. 17 7月, 2017 1 次提交
  14. 02 7月, 2017 3 次提交