05 Sep, 2020

1 commit

  • We got slightly different patches removing a double word
    in a comment in net/ipv4/raw.c - picked the version from net.

    Simple conflict in drivers/net/ethernet/ibm/ibmvnic.c. Use cached
    values instead of VNIC login response buffer (following what
    commit 507ebe6444a4 ("ibmvnic: Fix use-after-free of VNIC login
    response buffer") did).

    Signed-off-by: Jakub Kicinski

    Jakub Kicinski
     

25 Aug, 2020

1 commit


24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

02 Jun, 2020

1 commit

  • Pull crypto updates from Herbert Xu:
    "API:
    - Introduce crypto_shash_tfm_digest() and use it wherever possible.
    - Fix use-after-free and race in crypto_spawn_alg.
    - Add support for parallel and batch requests to crypto_engine.

    Algorithms:
    - Update jitter RNG for SP800-90B compliance.
    - Always use jitter RNG as seed in drbg.

    Drivers:
    - Add Arm CryptoCell driver cctrng.
    - Add support for SEV-ES to the PSP driver in ccp"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (114 commits)
    crypto: hisilicon - fix driver compatibility issue with different versions of devices
    crypto: engine - do not requeue in case of fatal error
    crypto: cavium/nitrox - Fix a typo in a comment
    crypto: hisilicon/qm - change debugfs file name from qm_regs to regs
    crypto: hisilicon/qm - add DebugFS for xQC and xQE dump
    crypto: hisilicon/zip - add debugfs for Hisilicon ZIP
    crypto: hisilicon/hpre - add debugfs for Hisilicon HPRE
    crypto: hisilicon/sec2 - add debugfs for Hisilicon SEC
    crypto: hisilicon/qm - add debugfs to the QM state machine
    crypto: hisilicon/qm - add debugfs for QM
    crypto: stm32/crc32 - protect from concurrent accesses
    crypto: stm32/crc32 - don't sleep in runtime pm
    crypto: stm32/crc32 - fix multi-instance
    crypto: stm32/crc32 - fix run-time self test issue.
    crypto: stm32/crc32 - fix ext4 chksum BUG_ON()
    crypto: hisilicon/zip - Use temporary sqe when doing work
    crypto: hisilicon - add device error report through abnormal irq
    crypto: hisilicon - remove codes of directly report device errors through MSI
    crypto: hisilicon - QM memory management optimization
    crypto: hisilicon - unify initial value assignment into QM
    ...

    Linus Torvalds
     

08 May, 2020

1 commit

  • Instead of manually allocating a 'struct shash_desc' on the stack and
    calling crypto_shash_digest(), switch to using the new helper function
    crypto_shash_tfm_digest() which does this for us.

    Cc: linux-sctp@vger.kernel.org
    Signed-off-by: Eric Biggers
    Signed-off-by: Herbert Xu

    Eric Biggers
     

23 Apr, 2020

1 commit

  • When starting shutdown in sctp_sf_do_dupcook_a(), get the value for
    SHUTDOWN Cumulative TSN Ack from the new association, which is
    reconstructed from the cookie, instead of the old association, which
    the peer doesn't have anymore.

    Otherwise the SHUTDOWN is either ignored or replied to with an ABORT
    by the peer because CTSN Ack doesn't match the peer's Initial TSN.

    Fixes: bdf6fa52f01b ("sctp: handle association restarts when the socket is closed.")
    Signed-off-by: Jere Leppänen
    Acked-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Jere Leppänen
     

10 Dec, 2019

1 commit

  • Commit 312434617cb1 ("sctp: cache netns in sctp_ep_common") set netns
    in asoc and ep base since they're created, and it will never change.
    It's a better way to get netns from asoc and ep base, comparing to
    calling sock_net().

    This patch is to replace them.

    v1->v2:
    - no change.

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

    Xin Long
     

12 Oct, 2019

1 commit


28 Aug, 2019

1 commit

  • This patch is to add ecn flag for both netns_sctp and sctp_endpoint,
    net->sctp.ecn_enable is set 1 by default, and ep->ecn_enable will
    be initialized with net->sctp.ecn_enable.

    asoc->peer.ecn_capable will be set during negotiation only when
    ep->ecn_enable is set on both sides.

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

    Xin Long
     

20 Aug, 2019

1 commit

  • This patch is to make addip/asconf flag per endpoint,
    and its value is initialized by the per netns flag,
    net->sctp.addip_enable.

    It also replaces the checks of net->sctp.addip_enable
    with ep->asconf_enable in some places.

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

    Xin Long
     

18 Jul, 2019

1 commit

  • This patch removes NULL checks before calling kfree.

    fixes below issues reported by coccicheck
    net/sctp/sm_make_chunk.c:2586:3-8: WARNING: NULL check before some
    freeing functions is not needed.
    net/sctp/sm_make_chunk.c:2652:3-8: WARNING: NULL check before some
    freeing functions is not needed.
    net/sctp/sm_make_chunk.c:2667:3-8: WARNING: NULL check before some
    freeing functions is not needed.
    net/sctp/sm_make_chunk.c:2684:3-8: WARNING: NULL check before some
    freeing functions is not needed.

    Signed-off-by: Hariprasad Kelam
    Acked-by: Marcelo Ricardo Leitner
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Hariprasad Kelam
     

09 Jul, 2019

4 commits


15 Jun, 2019

1 commit

  • Based on comments from Xin, even after fixes for our recent syzbot
    report of cookie memory leaks, its possible to get a resend of an INIT
    chunk which would lead to us leaking cookie memory.

    To ensure that we don't leak cookie memory, free any previously
    allocated cookie first.

    Change notes
    v1->v2
    update subsystem tag in subject (davem)
    repeat kfree check for peer_random and peer_hmacs (xin)

    v2->v3
    net->sctp
    also free peer_chunks

    v3->v4
    fix subject tags

    v4->v5
    remove cut line

    Signed-off-by: Neil Horman
    Reported-by: syzbot+f7e9153b037eac9b1df8@syzkaller.appspotmail.com
    CC: Marcelo Ricardo Leitner
    CC: Xin Long
    CC: "David S. Miller"
    CC: netdev@vger.kernel.org
    Acked-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Neil Horman
     

06 Jun, 2019

1 commit

  • syzbot found the following leak in sctp_process_init
    BUG: memory leak
    unreferenced object 0xffff88810ef68400 (size 1024):
    comm "syz-executor273", pid 7046, jiffies 4294945598 (age 28.770s)
    hex dump (first 32 bytes):
    1d de 28 8d de 0b 1b e3 b5 c2 f9 68 fd 1a 97 25 ..(........h...%
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    backtrace:
    [] kmemleak_alloc_recursive include/linux/kmemleak.h:55
    [inline]
    [] slab_post_alloc_hook mm/slab.h:439 [inline]
    [] slab_alloc mm/slab.c:3326 [inline]
    [] __do_kmalloc mm/slab.c:3658 [inline]
    [] __kmalloc_track_caller+0x15d/0x2c0 mm/slab.c:3675
    [] kmemdup+0x27/0x60 mm/util.c:119
    [] kmemdup include/linux/string.h:432 [inline]
    [] sctp_process_init+0xa7e/0xc20
    net/sctp/sm_make_chunk.c:2437
    [] sctp_cmd_process_init net/sctp/sm_sideeffect.c:682
    [inline]
    [] sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1384
    [inline]
    [] sctp_side_effects net/sctp/sm_sideeffect.c:1194
    [inline]
    [] sctp_do_sm+0xbdc/0x1d60 net/sctp/sm_sideeffect.c:1165
    [] sctp_assoc_bh_rcv+0x13c/0x200
    net/sctp/associola.c:1074
    [] sctp_inq_push+0x7f/0xb0 net/sctp/inqueue.c:95
    [] sctp_backlog_rcv+0x5e/0x2a0 net/sctp/input.c:354
    [] sk_backlog_rcv include/net/sock.h:950 [inline]
    [] __release_sock+0xab/0x110 net/core/sock.c:2418
    [] release_sock+0x37/0xd0 net/core/sock.c:2934
    [] sctp_sendmsg+0x2c0/0x990 net/sctp/socket.c:2122
    [] inet_sendmsg+0x64/0x120 net/ipv4/af_inet.c:802
    [] sock_sendmsg_nosec net/socket.c:652 [inline]
    [] sock_sendmsg+0x54/0x70 net/socket.c:671
    [] ___sys_sendmsg+0x393/0x3c0 net/socket.c:2292
    [] __sys_sendmsg+0x80/0xf0 net/socket.c:2330
    [] __do_sys_sendmsg net/socket.c:2339 [inline]
    [] __se_sys_sendmsg net/socket.c:2337 [inline]
    [] __x64_sys_sendmsg+0x23/0x30 net/socket.c:2337
    [] do_syscall_64+0x76/0x1a0 arch/x86/entry/common.c:3

    The problem was that the peer.cookie value points to an skb allocated
    area on the first pass through this function, at which point it is
    overwritten with a heap allocated value, but in certain cases, where a
    COOKIE_ECHO chunk is included in the packet, a second pass through
    sctp_process_init is made, where the cookie value is re-allocated,
    leaking the first allocation.

    Fix is to always allocate the cookie value, and free it when we are done
    using it.

    Signed-off-by: Neil Horman
    Reported-by: syzbot+f7e9153b037eac9b1df8@syzkaller.appspotmail.com
    CC: Marcelo Ricardo Leitner
    CC: "David S. Miller"
    CC: netdev@vger.kernel.org
    Acked-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Neil Horman
     

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
     

25 Apr, 2019

1 commit

  • The flags field in 'struct shash_desc' never actually does anything.
    The only ostensibly supported flag is CRYPTO_TFM_REQ_MAY_SLEEP.
    However, no shash algorithm ever sleeps, making this flag a no-op.

    With this being the case, inevitably some users who can't sleep wrongly
    pass MAY_SLEEP. These would all need to be fixed if any shash algorithm
    actually started sleeping. For example, the shash_ahash_*() functions,
    which wrap a shash algorithm with the ahash API, pass through MAY_SLEEP
    from the ahash API to the shash API. However, the shash functions are
    called under kmap_atomic(), so actually they're assumed to never sleep.

    Even if it turns out that some users do need preemption points while
    hashing large buffers, we could easily provide a helper function
    crypto_shash_update_large() which divides the data into smaller chunks
    and calls crypto_shash_update() and cond_resched() for each chunk. It's
    not necessary to have a flag in 'struct shash_desc', nor is it necessary
    to make individual shash algorithms aware of this at all.

    Therefore, remove shash_desc::flags, and document that the
    crypto_shash_*() functions can be called from any context.

    Signed-off-by: Eric Biggers
    Signed-off-by: Herbert Xu

    Eric Biggers
     

25 Jan, 2019

1 commit

  • In the paths:

    sctp_sf_do_unexpected_init() ->
    sctp_make_init_ack()
    sctp_sf_do_dupcook_a/b()() ->
    sctp_sf_do_5_1D_ce()

    The new chunk 'retval' transport is set from the incoming chunk 'chunk'
    transport. However, 'retval' transport belong to the new asoc, which
    is a different one from 'chunk' transport's asoc.

    It will cause that the 'retval' chunk gets set with a wrong transport.
    Later when sending it and because of Commit b9fd683982c9 ("sctp: add
    sctp_packet_singleton"), sctp_packet_singleton() will set some fields,
    like vtag to 'retval' chunk from that wrong transport's asoc.

    This patch is to fix it by setting 'retval' transport correctly which
    belongs to the right asoc in sctp_make_init_ack() and
    sctp_sf_do_5_1D_ce().

    Fixes: b9fd683982c9 ("sctp: add sctp_packet_singleton")
    Reported-by: Ying Xu
    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller

    Xin Long
     

01 Dec, 2018

1 commit

  • sctp_assoc_update_frag_point() should be called whenever asoc->pathmtu
    changes, but we missed one place in sctp_association_init(). It would
    cause frag_point is zero when sending data.

    As says in Jakub's reproducer, if sp->pathmtu is set by socketopt, the
    new asoc->pathmtu inherits it in sctp_association_init(). Later when
    transports are added and their pmtu >= asoc->pathmtu, it will never
    call sctp_assoc_update_frag_point() to set frag_point.

    This patch is to fix it by updating frag_point after asoc->pathmtu is
    set as sp->pathmtu in sctp_association_init(). Note that it moved them
    after sctp_stream_init(), as stream->si needs to be set first.

    Frag_point's calculation is also related with datachunk's type, so it
    needs to update frag_point when stream->si may be changed in
    sctp_process_init().

    v1->v2:
    - call sctp_assoc_update_frag_point() separately in sctp_process_init
    and sctp_association_init, per Marcelo's suggestion.

    Fixes: 2f5e3c9df693 ("sctp: introduce sctp_assoc_update_frag_point")
    Reported-by: Jakub Audykowicz
    Signed-off-by: Xin Long
    Acked-by: Marcelo Ricardo Leitner
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Xin Long
     

12 May, 2018

1 commit

  • The bpf syscall and selftests conflicts were trivial
    overlapping changes.

    The r8169 change involved moving the added mdelay from 'net' into a
    different function.

    A TLS close bug fix overlapped with the splitting of the TLS state
    into separate TX and RX parts. I just expanded the tests in the bug
    fix from "ctx->conf == X" into "ctx->tx_conf == X && ctx->rx_conf
    == X".

    Signed-off-by: David S. Miller

    David S. Miller
     

11 May, 2018

1 commit


02 May, 2018

2 commits


26 Apr, 2018

1 commit


07 Apr, 2018

1 commit

  • Pull SELinux updates from Paul Moore:
    "A bigger than usual pull request for SELinux, 13 patches (lucky!)
    along with a scary looking diffstat.

    Although if you look a bit closer, excluding the usual minor
    tweaks/fixes, there are really only two significant changes in this
    pull request: the addition of proper SELinux access controls for SCTP
    and the encapsulation of a lot of internal SELinux state.

    The SCTP changes are the result of a multi-month effort (maybe even a
    year or longer?) between the SELinux folks and the SCTP folks to add
    proper SELinux controls. A special thanks go to Richard for seeing
    this through and keeping the effort moving forward.

    The state encapsulation work is a bit of janitorial work that came out
    of some early work on SELinux namespacing. The question of namespacing
    is still an open one, but I believe there is some real value in the
    encapsulation work so we've split that out and are now sending that up
    to you"

    * tag 'selinux-pr-20180403' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
    selinux: wrap AVC state
    selinux: wrap selinuxfs state
    selinux: fix handling of uninitialized selinux state in get_bools/classes
    selinux: Update SELinux SCTP documentation
    selinux: Fix ltp test connect-syscall failure
    selinux: rename the {is,set}_enforcing() functions
    selinux: wrap global selinux state
    selinux: fix typo in selinux_netlbl_sctp_sk_clone declaration
    selinux: Add SCTP support
    sctp: Add LSM hooks
    sctp: Add ip option support
    security: Add support for SCTP security hooks
    netlabel: If PF_INET6, check sk_buff ip header version

    Linus Torvalds
     

15 Mar, 2018

2 commits

  • This patch is to add SCTP_AUTH_FREE_KEY type for AUTHENTICATION_EVENT,
    as described in section 6.1.8 of RFC6458.

    SCTP_AUTH_FREE_KEY: This report indicates that the SCTP
    implementation will no longer use the key identifier specified
    in auth_keynumber.

    After deactivating a key, it would never be used again, which means
    it's refcnt can't be held/increased by new chunks. But there may be
    some chunks in out queue still using it. So only when refcnt is 1,
    which means no chunk in outqueue is using/holding this key either,
    this EVENT would be sent.

    When users receive this notification, they could do DEL_KEY sockopt to
    remove this shkey, and also tell the peer that this key won't be used
    in any chunk thoroughly from now on, then the peer can remove it as
    well safely.

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

    Xin Long
     
  • With refcnt support for sh_key, chunks auth sh_keys can be decided
    before enqueuing it. Changing the active key later will not affect
    the chunks already enqueued.

    Furthermore, this is necessary when adding the support for authinfo
    for sendmsg in next patch.

    Note that struct sctp_chunk can't be grown due to that performance
    drop issue on slow cpu, so it just reuses head_skb memory for shkey
    in sctp_chunk.

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

    Xin Long
     

27 Feb, 2018

1 commit


10 Feb, 2018

1 commit

  • When SCTP makes INIT or INIT_ACK packet the total chunk length
    can exceed SCTP_MAX_CHUNK_LEN which leads to kernel panic when
    transmitting these packets, e.g. the crash on sending INIT_ACK:

    [ 597.804948] skbuff: skb_over_panic: text:00000000ffae06e4 len:120168
    put:120156 head:000000007aa47635 data:00000000d991c2de
    tail:0x1d640 end:0xfec0 dev:
    ...
    [ 597.976970] ------------[ cut here ]------------
    [ 598.033408] kernel BUG at net/core/skbuff.c:104!
    [ 600.314841] Call Trace:
    [ 600.345829]
    [ 600.371639] ? sctp_packet_transmit+0x2095/0x26d0 [sctp]
    [ 600.436934] skb_put+0x16c/0x200
    [ 600.477295] sctp_packet_transmit+0x2095/0x26d0 [sctp]
    [ 600.540630] ? sctp_packet_config+0x890/0x890 [sctp]
    [ 600.601781] ? __sctp_packet_append_chunk+0x3b4/0xd00 [sctp]
    [ 600.671356] ? sctp_cmp_addr_exact+0x3f/0x90 [sctp]
    [ 600.731482] sctp_outq_flush+0x663/0x30d0 [sctp]
    [ 600.788565] ? sctp_make_init+0xbf0/0xbf0 [sctp]
    [ 600.845555] ? sctp_check_transmitted+0x18f0/0x18f0 [sctp]
    [ 600.912945] ? sctp_outq_tail+0x631/0x9d0 [sctp]
    [ 600.969936] sctp_cmd_interpreter.isra.22+0x3be1/0x5cb0 [sctp]
    [ 601.041593] ? sctp_sf_do_5_1B_init+0x85f/0xc30 [sctp]
    [ 601.104837] ? sctp_generate_t1_cookie_event+0x20/0x20 [sctp]
    [ 601.175436] ? sctp_eat_data+0x1710/0x1710 [sctp]
    [ 601.233575] sctp_do_sm+0x182/0x560 [sctp]
    [ 601.284328] ? sctp_has_association+0x70/0x70 [sctp]
    [ 601.345586] ? sctp_rcv+0xef4/0x32f0 [sctp]
    [ 601.397478] ? sctp6_rcv+0xa/0x20 [sctp]
    ...

    Here the chunk size for INIT_ACK packet becomes too big, mostly
    because of the state cookie (INIT packet has large size with
    many address parameters), plus additional server parameters.

    Later this chunk causes the panic in skb_put_data():

    skb_packet_transmit()
    sctp_packet_pack()
    skb_put_data(nskb, chunk->skb->data, chunk->skb->len);

    'nskb' (head skb) was previously allocated with packet->size
    from u16 'chunk->chunk_hdr->length'.

    As suggested by Marcelo we should check the chunk's length in
    _sctp_make_chunk() before trying to allocate skb for it and
    discard a chunk if its size bigger than SCTP_MAX_CHUNK_LEN.

    Signed-off-by: Alexey Kodanev
    Acked-by: Marcelo Ricardo Leitner
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Alexey Kodanev
     

16 Jan, 2018

1 commit


16 Dec, 2017

1 commit

  • sctp_ifwdtsn_skip, sctp_ifwdtsn_hdr and sctp_ifwdtsn_chunk are used to
    define and parse I-FWD TSN chunk format, and sctp_make_ifwdtsn is a
    function to build the chunk.

    The I-FORWARD-TSN Chunk Format is defined in section 2.3.1 of RFC8260.

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

    Xin Long
     

12 Dec, 2017

3 commits

  • 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
     
  • sctp_idatahdr and sctp_idata_chunk are used to define and parse
    I-DATA chunk format, and sctp_make_idata is a function to build
    the chunk.

    The I-DATA Chunk Format is defined in section 2.1 of RFC8260.

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

    Xin Long
     
  • asoc intl_enable will be set when local sp strm_interleave is set
    and there's I-DATA chunk in init and init_ack extensions, as said
    in section 2.2.1 of RFC8260.

    asoc intl_enable indicates all data will be sent as I-DATA chunks.

    Signed-off-by: Xin Long
    Acked-by: Marcelo Ricardo Leitner
    Acked-by: Neil Horman
    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
     

29 Oct, 2017

2 commits

  • These warnings were found by running 'make C=2 M=net/sctp/'.
    They are there since very beginning.

    Note after this patch, there still one warning left in
    sctp_outq_flush():
    sctp_chunk_fail(chunk, SCTP_ERROR_INV_STRM)

    Since it has been moved to sctp_stream_outq_migrate on net-next,
    to avoid the extra job when merging net-next to net, I will post
    the fix for it after the merging is done.

    Reported-by: Eric Dumazet
    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller

    Xin Long
     
  • 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
     

12 Aug, 2017

1 commit

  • There are some bad indents of functions' defination in sm_make_chunk.c.
    They have been there since beginning, it was probably caused by that
    the typedef sctp_chunk_t was replaced with struct sctp_chunk.

    So it's the best time to fix them in this patchset, it's also to fix
    some bad indents in other functions' defination in sm_make_chunk.c.

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

    Xin Long