07 Aug, 2017

2 commits

  • This patch is to remove the typedef sctp_subtype_t, and
    replace with union sctp_subtype in the places where it's
    using this typedef.

    Note that it doesn't fix many indents although it should,
    as sctp_disposition_t's removal would mess them up again.
    So better to fix them when removing sctp_disposition_t in
    later patch.

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

    Xin Long
     
  • This patch is to remove the typedef sctp_state_t, and
    replace with enum sctp_state in the places where it's
    using this typedef.

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

    Xin Long
     

17 Jul, 2017

2 commits

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

    It is also to use sizeof(variable) instead of sizeof(type).

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

    Xin Long
     
  • This patch is to remove the typedef sctp_chunks_param_t, and
    replace with struct sctp_chunks_param in the places where it's
    using this typedef.

    It is also to use sizeof(variable) instead of sizeof(type).

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

    Xin Long
     

05 Jul, 2017

1 commit


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
     

01 Jul, 2017

1 commit


20 Jun, 2017

1 commit

  • Now before dumping a sock in sctp_diag, it only holds the sock while
    the ep may be already destroyed. It can cause a use-after-free panic
    when accessing ep->asocs.

    This patch is to set sctp_sk(sk)->ep NULL in sctp_endpoint_destroy,
    and check if this ep is already destroyed before dumping this ep.

    Suggested-by: Marcelo Ricardo Leitner
    Signed-off-by: Xin Long
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Xin Long
     

19 Jan, 2017

1 commit

  • This patch is to add reconf_enable field in all of asoc ep and netns
    to indicate if they support stream reset.

    When initializing, asoc reconf_enable get the default value from ep
    reconf_enable which is from netns netns reconf_enable by default.

    It is also to add reconf_capable in asoc peer part to know if peer
    supports reconf_enable, the value is set if ext params have reconf
    chunk support when processing init chunk, just as rfc6525 section
    5.1.1 demands.

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

    Xin Long
     

18 Dec, 2016

1 commit

  • Since commit 7fda702f9315 ("sctp: use new rhlist interface on sctp transport
    rhashtable"), sctp has changed to use rhlist_lookup to look up transport, but
    rhlist_lookup doesn't call rcu_read_lock inside, unlike rhashtable_lookup_fast.

    It is called in sctp_epaddr_lookup_transport and sctp_addrs_lookup_transport.
    sctp_addrs_lookup_transport is always in the protection of rcu_read_lock(),
    as __sctp_lookup_association is called in rx path or sctp_lookup_association
    which are in the protection of rcu_read_lock() already.

    But sctp_epaddr_lookup_transport is called by sctp_endpoint_lookup_assoc, it
    doesn't call rcu_read_lock, which may cause "suspicious rcu_dereference_check
    usage' in __rhashtable_lookup.

    This patch is to fix it by adding rcu_read_lock in sctp_endpoint_lookup_assoc
    before calling sctp_epaddr_lookup_transport.

    Fixes: 7fda702f9315 ("sctp: use new rhlist interface on sctp transport rhashtable")
    Reported-by: Dmitry Vyukov
    Signed-off-by: Xin Long
    Acked-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Xin Long
     

12 Jul, 2016

1 commit

  • According to section 4.5 of rfc7496, prsctp_enable should be per asoc.
    We will add prsctp_enable to both asoc and ep, and replace the places
    where it used net.sctp->prsctp_enable with asoc->prsctp_enable.

    ep->prsctp_enable will be initialized with net.sctp->prsctp_enable, and
    asoc->prsctp_enable will be initialized with ep->prsctp_enable. We can
    also modify it's value through sockopt SCTP_PR_SUPPORTED.

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

    Xin Long
     

27 Jan, 2016

1 commit


18 Jan, 2016

1 commit

  • Re-establish the previous behavior and avoid hashing temporary asocs by
    checking t->asoc->temp in sctp_(un)hash_transport. Also, remove the
    check of t->asoc->temp in __sctp_lookup_association, since they are
    never hashed now.

    Fixes: 4f0087812648 ("sctp: apply rhashtable api to send/recv path")
    Signed-off-by: Xin Long
    Acked-by: Marcelo Ricardo Leitner
    Reported-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Xin Long
     

06 Jan, 2016

2 commits


12 Jun, 2014

1 commit

  • Be more precise in transport path selection and use ktime
    helpers instead of jiffies to compare and pick the better
    primary and secondary recently used transports. This also
    avoids any side-effects during a possible roll-over, and
    could lead to better path decision-making.

    Signed-off-by: Daniel Borkmann
    Signed-off-by: David S. Miller

    Daniel Borkmann
     

19 Apr, 2014

1 commit

  • Currently, it is possible to create an SCTP socket, then switch
    auth_enable via sysctl setting to 1 and crash the system on connect:

    Oops[#1]:
    CPU: 0 PID: 0 Comm: swapper Not tainted 3.14.1-mipsgit-20140415 #1
    task: ffffffff8056ce80 ti: ffffffff8055c000 task.ti: ffffffff8055c000
    [...]
    Call Trace:
    [] sctp_auth_asoc_set_default_hmac+0x68/0x80
    [] sctp_process_init+0x5e0/0x8a4
    [] sctp_sf_do_5_1B_init+0x234/0x34c
    [] sctp_do_sm+0xb4/0x1e8
    [] sctp_endpoint_bh_rcv+0x1c4/0x214
    [] sctp_rcv+0x588/0x630
    [] sctp6_rcv+0x10/0x24
    [] ip6_input+0x2c0/0x440
    [] __netif_receive_skb_core+0x4a8/0x564
    [] process_backlog+0xb4/0x18c
    [] net_rx_action+0x12c/0x210
    [] __do_softirq+0x17c/0x2ac
    [] irq_exit+0x54/0xb0
    [] ret_from_irq+0x0/0x4
    [] rm7k_wait_irqoff+0x24/0x48
    [] cpu_startup_entry+0xc0/0x148
    [] start_kernel+0x37c/0x398
    Code: dd0900b8 000330f8 0126302d 50c0fff1 0047182a a48306a0
    03e00008 00000000
    ---[ end trace b530b0551467f2fd ]---
    Kernel panic - not syncing: Fatal exception in interrupt

    What happens while auth_enable=0 in that case is, that
    ep->auth_hmacs is initialized to NULL in sctp_auth_init_hmacs()
    when endpoint is being created.

    After that point, if an admin switches over to auth_enable=1,
    the machine can crash due to NULL pointer dereference during
    reception of an INIT chunk. When we enter sctp_process_init()
    via sctp_sf_do_5_1B_init() in order to respond to an INIT chunk,
    the INIT verification succeeds and while we walk and process
    all INIT params via sctp_process_param() we find that
    net->sctp.auth_enable is set, therefore do not fall through,
    but invoke sctp_auth_asoc_set_default_hmac() instead, and thus,
    dereference what we have set to NULL during endpoint
    initialization phase.

    The fix is to make auth_enable immutable by caching its value
    during endpoint initialization, so that its original value is
    being carried along until destruction. The bug seems to originate
    from the very first days.

    Fix in joint work with Daniel Borkmann.

    Reported-by: Joshua Kinard
    Signed-off-by: Vlad Yasevich
    Signed-off-by: Daniel Borkmann
    Acked-by: Neil Horman
    Tested-by: Joshua Kinard
    Signed-off-by: David S. Miller

    Vlad Yasevich
     

22 Jan, 2014

1 commit


07 Dec, 2013

1 commit

  • Several files refer to an old address for the Free Software Foundation
    in the file header comment. Resolve by replacing the address with
    the URL so that we do not have to keep
    updating the header comments anytime the address changes.

    CC: Vlad Yasevich
    CC: Neil Horman
    Signed-off-by: Jeff Kirsher
    Signed-off-by: David S. Miller

    Jeff Kirsher
     

10 Aug, 2013

1 commit

  • With the restructuring of the lksctp.org site, we only allow bug
    reports through the SCTP mailing list linux-sctp@vger.kernel.org,
    not via SF, as SF is only used for web hosting and nothing more.
    While at it, also remove the obvious statement that bugs will be
    fixed and incooperated into the kernel.

    Signed-off-by: Daniel Borkmann
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Daniel Borkmann
     

25 Jul, 2013

1 commit

  • The SCTP mailing list address to send patches or questions
    to is linux-sctp@vger.kernel.org and not
    lksctp-developers@lists.sourceforge.net anymore. Therefore,
    update all occurences.

    Signed-off-by: Daniel Borkmann
    Acked-by: Neil Horman
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Daniel Borkmann
     

02 Jul, 2013

1 commit

  • We should get rid of all own SCTP debug printk macros and use the ones
    that the kernel offers anyway instead. This makes the code more readable
    and conform to the kernel code, and offers all the features of dynamic
    debbuging that pr_debug() et al has, such as only turning on/off portions
    of debug messages at runtime through debugfs. The runtime cost of having
    CONFIG_DYNAMIC_DEBUG enabled, but none of the debug statements printing,
    is negligible [1]. If kernel debugging is completly turned off, then these
    statements will also compile into "empty" functions.

    While we're at it, we also need to change the Kconfig option as it /now/
    only refers to the ifdef'ed code portions in outqueue.c that enable further
    debugging/tracing of SCTP transaction fields. Also, since SCTP_ASSERT code
    was enabled with this Kconfig option and has now been removed, we
    transform those code parts into WARNs resp. where appropriate BUG_ONs so
    that those bugs can be more easily detected as probably not many people
    have SCTP debugging permanently turned on.

    To turn on all SCTP debugging, the following steps are needed:

    # mount -t debugfs none /sys/kernel/debug
    # echo -n 'module sctp +p' > /sys/kernel/debug/dynamic_debug/control

    This can be done more fine-grained on a per file, per line basis and others
    as described in [2].

    [1] https://www.kernel.org/doc/ols/2009/ols2009-pages-39-46.pdf
    [2] Documentation/dynamic-debug-howto.txt

    Signed-off-by: Daniel Borkmann
    Signed-off-by: David S. Miller

    Daniel Borkmann
     

26 Jun, 2013

1 commit

  • Rather instead of having the endpoint clean the garbage from the
    socket, use a sk_destruct handler sctp_destruct_sock(), that does
    the job for that when there are no more references on the socket.
    At least do this for our crypto transform through crypto_free_hash()
    that is allocated when in listening state.

    Also, perform sctp_put_port() only when sk is valid. At a later
    point in time we can still determine if there's an option of
    placing this into sk_prot->unhash() or sctp_endpoint_free() without
    any races. For now, leave it in sctp_endpoint_destroy() though.

    Signed-off-by: Daniel Borkmann
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Daniel Borkmann
     

18 Jun, 2013

1 commit


16 Apr, 2013

2 commits

  • Since dead only holds two states (0,1), make it a bool instead
    of a 'char', which is more appropriate for its purpose.

    Signed-off-by: Daniel Borkmann
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Daniel Borkmann
     
  • There is actually no need to keep this member in the structure, because
    after init it's always 1 anyway, thus always kfree called. This seems to
    be an ancient leftover from the very initial implementation from 2.5
    times. Only in case the initialization of an association fails, we leave
    base.malloced as 0, but we nevertheless kfree it in the error path in
    sctp_association_new().

    Signed-off-by: Daniel Borkmann
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Daniel Borkmann
     

06 Mar, 2013

1 commit

  • Pull networking fixes from David Miller:
    "A moderately sized pile of fixes, some specifically for merge window
    introduced regressions although others are for longer standing items
    and have been queued up for -stable.

    I'm kind of tired of all the RDS protocol bugs over the years, to be
    honest, it's way out of proportion to the number of people who
    actually use it.

    1) Fix missing range initialization in netfilter IPSET, from Jozsef
    Kadlecsik.

    2) ieee80211_local->tim_lock needs to use BH disabling, from Johannes
    Berg.

    3) Fix DMA syncing in SFC driver, from Ben Hutchings.

    4) Fix regression in BOND device MAC address setting, from Jiri
    Pirko.

    5) Missing usb_free_urb in ISDN Hisax driver, from Marina Makienko.

    6) Fix UDP checksumming in bnx2x driver for 57710 and 57711 chips,
    fix from Dmitry Kravkov.

    7) Missing cfgspace_lock initialization in BCMA driver.

    8) Validate parameter size for SCTP assoc stats getsockopt(), from
    Guenter Roeck.

    9) Fix SCTP association hangs, from Lee A Roberts.

    10) Fix jumbo frame handling in r8169, from Francois Romieu.

    11) Fix phy_device memory leak, from Petr Malat.

    12) Omit trailing FCS from frames received in BGMAC driver, from Hauke
    Mehrtens.

    13) Missing socket refcount release in L2TP, from Guillaume Nault.

    14) sctp_endpoint_init should respect passed in gfp_t, rather than use
    GFP_KERNEL unconditionally. From Dan Carpenter.

    15) Add AISX AX88179 USB driver, from Freddy Xin.

    16) Remove MAINTAINERS entries for drivers deleted during the merge
    window, from Cesar Eduardo Barros.

    17) RDS protocol can try to allocate huge amounts of memory, check
    that the user's request length makes sense, from Cong Wang.

    18) SCTP should use the provided KMALLOC_MAX_SIZE instead of it's own,
    bogus, definition. From Cong Wang.

    19) Fix deadlocks in FEC driver by moving TX reclaim into NAPI poll,
    from Frank Li. Also, fix a build error introduced in the merge
    window.

    20) Fix bogus purging of default routes in ipv6, from Lorenzo Colitti.

    21) Don't double count RTT measurements when we leave the TCP receive
    fast path, from Neal Cardwell."

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (61 commits)
    tcp: fix double-counted receiver RTT when leaving receiver fast path
    CAIF: fix sparse warning for caif_usb
    rds: simplify a warning message
    net: fec: fix build error in no MXC platform
    net: ipv6: Don't purge default router if accept_ra=2
    net: fec: put tx to napi poll function to fix dead lock
    sctp: use KMALLOC_MAX_SIZE instead of its own MAX_KMALLOC_SIZE
    rds: limit the size allocated by rds_message_alloc()
    MAINTAINERS: remove eexpress
    MAINTAINERS: remove drivers/net/wan/cycx*
    MAINTAINERS: remove 3c505
    caif_dev: fix sparse warnings for caif_flow_cb
    ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver
    sctp: use the passed in gfp flags instead GFP_KERNEL
    ipv[4|6]: correct dropwatch false positive in local_deliver_finish
    l2tp: Restore socket refcount when sendmsg succeeds
    net/phy: micrel: Disable asymmetric pause for KSZ9021
    bgmac: omit the fcs
    phy: Fix phy_device_free memory leak
    bnx2x: Fix KR2 work-around condition
    ...

    Linus Torvalds
     

02 Mar, 2013

1 commit


28 Feb, 2013

1 commit

  • I'm not sure why, but the hlist for each entry iterators were conceived

    list_for_each_entry(pos, head, member)

    The hlist ones were greedy and wanted an extra parameter:

    hlist_for_each_entry(tpos, pos, head, member)

    Why did they need an extra pos parameter? I'm not quite sure. Not only
    they don't really need it, it also prevents the iterator from looking
    exactly like the list iterator, which is unfortunate.

    Besides the semantic patch, there was some manual work required:

    - Fix up the actual hlist iterators in linux/list.h
    - Fix up the declaration of other iterators based on the hlist ones.
    - A very small amount of places were using the 'node' parameter, this
    was modified to use 'obj->member' instead.
    - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
    properly, so those had to be fixed up manually.

    The semantic patch which is mostly the work of Peter Senna Tschudin is here:

    @@
    iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

    type T;
    expression a,c,d,e;
    identifier b;
    statement S;
    @@

    -T b;

    [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
    [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
    [akpm@linux-foundation.org: checkpatch fixes]
    [akpm@linux-foundation.org: fix warnings]
    [akpm@linux-foudnation.org: redo intrusive kvm changes]
    Tested-by: Peter Senna Tschudin
    Acked-by: Paul E. McKenney
    Signed-off-by: Sasha Levin
    Cc: Wu Fengguang
    Cc: Marcelo Tosatti
    Cc: Gleb Natapov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasha Levin
     

13 Feb, 2013

1 commit

  • Vlad says: The whole multiple cookie keys code is completely unused
    and has been all this time. Noone uses anything other then the
    secret_key[0] since there is no changeover support anywhere.

    Thus, for now clean up its left-over fragments.

    Cc: Neil Horman
    Cc: Vlad Yasevich
    Signed-off-by: Daniel Borkmann
    Acked-by: Neil Horman
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Daniel Borkmann
     

09 Feb, 2013

1 commit


14 Dec, 2012

1 commit

  • Pull trivial branch from Jiri Kosina:
    "Usual stuff -- comment/printk typo fixes, documentation updates, dead
    code elimination."

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
    HOWTO: fix double words typo
    x86 mtrr: fix comment typo in mtrr_bp_init
    propagate name change to comments in kernel source
    doc: Update the name of profiling based on sysfs
    treewide: Fix typos in various drivers
    treewide: Fix typos in various Kconfig
    wireless: mwifiex: Fix typo in wireless/mwifiex driver
    messages: i2o: Fix typo in messages/i2o
    scripts/kernel-doc: check that non-void fcts describe their return value
    Kernel-doc: Convention: Use a "Return" section to describe return values
    radeon: Fix typo and copy/paste error in comments
    doc: Remove unnecessary declarations from Documentation/accounting/getdelays.c
    various: Fix spelling of "asynchronous" in comments.
    Fix misspellings of "whether" in comments.
    eisa: Fix spelling of "asynchronous".
    various: Fix spelling of "registered" in comments.
    doc: fix quite a few typos within Documentation
    target: iscsi: fix comment typos in target/iscsi drivers
    treewide: fix typo of "suport" in various comments and Kconfig
    treewide: fix typo of "suppport" in various comments
    ...

    Linus Torvalds
     

04 Dec, 2012

1 commit

  • The current SCTP stack is lacking a mechanism to have per association
    statistics. This is an implementation modeled after OpenSolaris'
    SCTP_GET_ASSOC_STATS.

    Userspace part will follow on lksctp if/when there is a general ACK on
    this.
    V4:
    - Move ipackets++ before q->immediate.func() for consistency reasons
    - Move sctp_max_rto() at the end of sctp_transport_update_rto() to avoid
    returning bogus RTO values
    - return asoc->rto_min when max_obs_rto value has not changed

    V3:
    - Increase ictrlchunks in sctp_assoc_bh_rcv() as well
    - Move ipackets++ to sctp_inq_push()
    - return 0 when no rto updates took place since the last call

    V2:
    - Implement partial retrieval of stat struct to cope for future expansion
    - Kill the rtxpackets counter as it cannot be precise anyway
    - Rename outseqtsns to outofseqtsns to make it clearer that these are out
    of sequence unexpected TSNs
    - Move asoc->ipackets++ under a lock to avoid potential miscounts
    - Fold asoc->opackets++ into the already existing asoc check
    - Kill unneeded (q->asoc) test when increasing rtxchunks
    - Do not count octrlchunks if sending failed (SCTP_XMIT_OK != 0)
    - Don't count SHUTDOWNs as SACKs
    - Move SCTP_GET_ASSOC_STATS to the private space API
    - Adjust the len check in sctp_getsockopt_assoc_stats() to allow for
    future struct growth
    - Move association statistics in their own struct
    - Update idupchunks when we send a SACK with dup TSNs
    - return min_rto in max_rto when RTO has not changed. Also return the
    transport when max_rto last changed.

    Signed-off: Michele Baldessari
    Acked-by: Vlad Yasevich

    Signed-off-by: David S. Miller

    Michele Baldessari
     

19 Nov, 2012

1 commit


15 Aug, 2012

5 commits


02 Dec, 2011

1 commit