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
     

14 Jul, 2020

2 commits

  • Simple fixes which require no deep knowledge of the code.

    Cc: Gerrit Renker
    Signed-off-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • Rationale:
    Reduces attack surface on kernel devs opening the links for MITM
    as HTTPS traffic is much harder to manipulate.

    Deterministic algorithm:
    For each file:
    If not .svg:
    For each line:
    If doesn't contain `\bxmlns\b`:
    For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
    If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
    If both the HTTP and HTTPS versions
    return 200 OK and serve the same content:
    Replace HTTP with HTTPS.

    Signed-off-by: Alexander A. Klimov
    Signed-off-by: David S. Miller

    Alexander A. Klimov
     

14 Jun, 2020

1 commit

  • Since commit 84af7a6194e4 ("checkpatch: kconfig: prefer 'help' over
    '---help---'"), the number of '---help---' has been gradually
    decreasing, but there are still more than 2400 instances.

    This commit finishes the conversion. While I touched the lines,
    I also fixed the indentation.

    There are a variety of indentation styles found.

    a) 4 spaces + '---help---'
    b) 7 spaces + '---help---'
    c) 8 spaces + '---help---'
    d) 1 space + 1 tab + '---help---'
    e) 1 tab + '---help---' (correct indentation)
    f) 1 tab + 1 space + '---help---'
    g) 1 tab + 2 spaces + '---help---'

    In order to convert all of them to 1 tab + 'help', I ran the
    following commend:

    $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

31 May, 2019

2 commits

  • Based on 1 normalized pattern(s):

    this program 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 of the license or at
    your option any later version

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 3029 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     
  • Based on 1 normalized pattern(s):

    this program 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 of the license or at your
    option any later version this program 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 this program if not write to
    the free software foundation inc 675 mass ave cambridge ma 02139 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 4 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Richard Fontana
    Reviewed-by: Kate Stewart
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190524100843.499675784@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

24 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program 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 of the license or at
    your option any later version this program 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 this program if not write to the free software foundation inc
    675 mass ave cambridge ma 02139 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 441 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Michael Ellerman (powerpc)
    Reviewed-by: Richard Fontana
    Reviewed-by: Allison Randal
    Reviewed-by: Kate Stewart
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190520071858.739733335@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2019

1 commit


08 Aug, 2018

1 commit

  • The shift of 'cwnd' with '(now - hc->tx_lsndtime) / hc->tx_rto' value
    can lead to undefined behavior [1].

    In order to fix this use a gradual shift of the window with a 'while'
    loop, similar to what tcp_cwnd_restart() is doing.

    When comparing delta and RTO there is a minor difference between TCP
    and DCCP, the last one also invokes dccp_cwnd_restart() and reduces
    'cwnd' if delta equals RTO. That case is preserved in this change.

    [1]:
    [40850.963623] UBSAN: Undefined behaviour in net/dccp/ccids/ccid2.c:237:7
    [40851.043858] shift exponent 67 is too large for 32-bit type 'unsigned int'
    [40851.127163] CPU: 3 PID: 15940 Comm: netstress Tainted: G W E 4.18.0-rc7.x86_64 #1
    ...
    [40851.377176] Call Trace:
    [40851.408503] dump_stack+0xf1/0x17b
    [40851.451331] ? show_regs_print_info+0x5/0x5
    [40851.503555] ubsan_epilogue+0x9/0x7c
    [40851.548363] __ubsan_handle_shift_out_of_bounds+0x25b/0x2b4
    [40851.617109] ? __ubsan_handle_load_invalid_value+0x18f/0x18f
    [40851.686796] ? xfrm4_output_finish+0x80/0x80
    [40851.739827] ? lock_downgrade+0x6d0/0x6d0
    [40851.789744] ? xfrm4_prepare_output+0x160/0x160
    [40851.845912] ? ip_queue_xmit+0x810/0x1db0
    [40851.895845] ? ccid2_hc_tx_packet_sent+0xd36/0x10a0 [dccp]
    [40851.963530] ccid2_hc_tx_packet_sent+0xd36/0x10a0 [dccp]
    [40852.029063] dccp_xmit_packet+0x1d3/0x720 [dccp]
    [40852.086254] dccp_write_xmit+0x116/0x1d0 [dccp]
    [40852.142412] dccp_sendmsg+0x428/0xb20 [dccp]
    [40852.195454] ? inet_dccp_listen+0x200/0x200 [dccp]
    [40852.254833] ? sched_clock+0x5/0x10
    [40852.298508] ? sched_clock+0x5/0x10
    [40852.342194] ? inet_create+0xdf0/0xdf0
    [40852.388988] sock_sendmsg+0xd9/0x160
    ...

    Fixes: 113ced1f52e5 ("dccp ccid-2: Perform congestion-window validation")
    Signed-off-by: Alexey Kodanev
    Signed-off-by: David S. Miller

    Alexey Kodanev
     

23 Jun, 2018

2 commits


13 Jun, 2018

1 commit

  • The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
    patch replaces cases of:

    kmalloc(a * b, gfp)

    with:
    kmalloc_array(a * b, gfp)

    as well as handling cases of:

    kmalloc(a * b * c, gfp)

    with:

    kmalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kmalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kmalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The tools/ directory was manually excluded, since it has its own
    implementation of kmalloc().

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kmalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kmalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kmalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kmalloc
    + kmalloc_array
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kmalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kmalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kmalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kmalloc(sizeof(THING) * C2, ...)
    |
    kmalloc(sizeof(TYPE) * C2, ...)
    |
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(C1 * C2, ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

04 May, 2018

1 commit

  • syzbot reported a crash in tasklet_action_common() caused by dccp.

    dccp needs to make sure socket wont disappear before tasklet handler
    has completed.

    This patch takes a reference on the socket when arming the tasklet,
    and moves the sock_put() from dccp_write_xmit_timer() to dccp_write_xmitlet()

    kernel BUG at kernel/softirq.c:514!
    invalid opcode: 0000 [#1] SMP KASAN
    Dumping ftrace buffer:
    (ftrace buffer empty)
    Modules linked in:
    CPU: 1 PID: 17 Comm: ksoftirqd/1 Not tainted 4.17.0-rc3+ #30
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    RIP: 0010:tasklet_action_common.isra.19+0x6db/0x700 kernel/softirq.c:515
    RSP: 0018:ffff8801d9b3faf8 EFLAGS: 00010246
    dccp_close: ABORT with 65423 bytes unread
    RAX: 1ffff1003b367f6b RBX: ffff8801daf1f3f0 RCX: 0000000000000000
    RDX: ffff8801cf895498 RSI: 0000000000000004 RDI: 0000000000000000
    RBP: ffff8801d9b3fc40 R08: ffffed0039f12a95 R09: ffffed0039f12a94
    dccp_close: ABORT with 65423 bytes unread
    R10: ffffed0039f12a94 R11: ffff8801cf8954a3 R12: 0000000000000000
    R13: ffff8801d9b3fc18 R14: dffffc0000000000 R15: ffff8801cf895490
    FS: 0000000000000000(0000) GS:ffff8801daf00000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000001b2bc28000 CR3: 00000001a08a9000 CR4: 00000000001406e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
    tasklet_action+0x1d/0x20 kernel/softirq.c:533
    __do_softirq+0x2e0/0xaf5 kernel/softirq.c:285
    dccp_close: ABORT with 65423 bytes unread
    run_ksoftirqd+0x86/0x100 kernel/softirq.c:646
    smpboot_thread_fn+0x417/0x870 kernel/smpboot.c:164
    kthread+0x345/0x410 kernel/kthread.c:238
    ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:412
    Code: 48 8b 85 e8 fe ff ff 48 8b 95 f0 fe ff ff e9 94 fb ff ff 48 89 95 f0 fe ff ff e8 81 53 6e 00 48 8b 95 f0 fe ff ff e9 62 fb ff ff 0b 48 89 cf 48 89 8d e8 fe ff ff e8 64 53 6e 00 48 8b 8d e8
    RIP: tasklet_action_common.isra.19+0x6db/0x700 kernel/softirq.c:515 RSP: ffff8801d9b3faf8

    Fixes: dc841e30eaea ("dccp: Extend CCID packet dequeueing interface")
    Signed-off-by: Eric Dumazet
    Reported-by: syzbot
    Cc: Gerrit Renker
    Cc: dccp@vger.kernel.org
    Signed-off-by: David S. Miller

    Eric Dumazet
     

27 Jan, 2018

1 commit

  • ccid2_hc_tx_rto_expire() timer callback always restarts the timer
    again and can run indefinitely (unless it is stopped outside), and after
    commit 120e9dabaf55 ("dccp: defer ccid_hc_tx_delete() at dismantle time"),
    which moved ccid_hc_tx_delete() (also includes sk_stop_timer()) from
    dccp_destroy_sock() to sk_destruct(), this started to happen quite often.
    The timer prevents releasing the socket, as a result, sk_destruct() won't
    be called.

    Found with LTP/dccp_ipsec tests running on the bonding device,
    which later couldn't be unloaded after the tests were completed:

    unregister_netdevice: waiting for bond0 to become free. Usage count = 148

    Fixes: 2a91aa396739 ("[DCCP] CCID2: Initial CCID2 (TCP-Like) implementation")
    Signed-off-by: Alexey Kodanev
    Reviewed-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Alexey Kodanev
     

04 Nov, 2017

1 commit


02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

01 Nov, 2017

1 commit


25 Oct, 2017

1 commit

  • In preparation for unconditionally passing the struct timer_list pointer to
    all timer callbacks, switch to using the new timer_setup() and from_timer()
    to pass the timer pointer explicitly. Adds a pointer back to the sock.

    Cc: Gerrit Renker
    Cc: "David S. Miller"
    Cc: Soheil Hassas Yeganeh
    Cc: Hannes Frederic Sowa
    Cc: Eric Dumazet
    Cc: dccp@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Signed-off-by: Kees Cook
    Signed-off-by: David S. Miller

    Kees Cook
     

18 May, 2017

1 commit


14 Mar, 2017

1 commit


17 Feb, 2014

1 commit

  • dccp tfrc: revert

    This reverts 6aee49c558de ("dccp: make local variable static") since
    the variable tfrc_debug is referenced by the tfrc_pr_debug(fmt, ...)
    macro when TFRC debugging is enabled. If it is enabled, use of the
    macro produces a compilation error.

    Signed-off-by: Gerrit Renker
    Signed-off-by: David S. Miller

    Gerrit Renker
     

05 Jan, 2014

1 commit


20 Oct, 2013

1 commit

  • There are a mix of function prototypes with and without extern
    in the kernel sources. Standardize on not using extern for
    function prototypes.

    Function prototypes don't need to be written with extern.
    extern is assumed by the compiler. Its use is as unnecessary as
    using auto to declare automatic/local variables in a block.

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

12 Jan, 2013

1 commit

  • The CONFIG_EXPERIMENTAL config item has not carried much meaning for a
    while now and is almost always enabled by default. As agreed during the
    Linux kernel summit, remove it from any "depends on" lines in Kconfigs.

    CC: Gerrit Renker
    CC: "David S. Miller"
    Signed-off-by: Kees Cook
    Acked-by: David S. Miller
    Acked-by: Gerrit Renker

    Kees Cook
     

16 Aug, 2012

1 commit

  • The CCID3 code fails to initialize the trailing padding bytes of struct
    tfrc_tx_info added for alignment on 64 bit architectures. It that for
    potentially leaks four bytes kernel stack via the getsockopt() syscall.
    Add an explicit memset(0) before filling the structure to avoid the
    info leak.

    Signed-off-by: Mathias Krause
    Cc: Gerrit Renker
    Signed-off-by: David S. Miller

    Mathias Krause
     

11 Jul, 2012

1 commit


16 Apr, 2012

1 commit


04 Mar, 2012

1 commit

  • This replaces an unjustified BUG_ON(), which could get triggered under normal
    conditions: X_calc can be 0 when p > 0. X would in this case be set to the
    minimum, s/t_mbi. Its replacement avoids t_ipi = 0 (unbounded sending rate).

    Thanks to Jordi, Victor and Xavier who reported this.

    Signed-off-by: Gerrit Renker
    Acked-by: Ian McDonald

    Gerrit Renker
     

20 Dec, 2011

1 commit

  • module_param(bool) used to counter-intuitively take an int. In
    fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
    trick.

    It's time to remove the int/unsigned int option. For this version
    it'll simply give a warning, but it'll break next kernel version.

    (Thanks to Joe Perches for suggesting coccinelle for 0/1 -> true/false).

    Cc: "David S. Miller"
    Cc: netdev@vger.kernel.org
    Signed-off-by: Rusty Russell
    Signed-off-by: David S. Miller

    Rusty Russell
     

01 Nov, 2011

1 commit


01 Aug, 2011

4 commits

  • This patch causes CCID-2 to check the Ack Ratio after reducing the congestion
    window. If the Ack Ratio is greater than the congestion window, it is
    reduced. This prevents timeouts caused by an Ack Ratio larger than the
    congestion window.

    In this situation, we choose to set the Ack Ratio to half the congestion window
    (or one if that's zero) so that if we loose one ack we don't trigger a timeout.

    Signed-off-by: Samuel Jero
    Acked-by: Gerrit Renker

    Samuel Jero
     
  • This patch fixes an issue where CCID-2 will not increase the congestion
    window for numerous RTTs after an idle period, application-limited period,
    or a loss once the algorithm is in Congestion Avoidance.

    What happens is that, when CCID-2 is in Congestion Avoidance mode, it will
    increase hc->tx_packets_acked by one for every packet and will increment cwnd
    every cwnd packets. However, if there is now an idle period in the connection,
    cwnd will be reduced, possibly below the slow start threshold. This will
    cause the connection to go into Slow Start. However, in Slow Start CCID-2
    performs this test to increment cwnd every second ack:

    ++hc->tx_packets_acked == 2

    Unfortunately, this will be incorrect, if cwnd previous to the idle period
    was larger than 2 and if tx_packets_acked was close to cwnd. For example:
    cwnd=50 and tx_packets_acked=45.

    In this case, the current code, will increment tx_packets_acked until it
    equals two, which will only be once tx_packets_acked (an unsigned 32-bit
    integer) overflows.

    My fix is simply to change that test for tx_packets_acked greater than or
    equal to two in slow start.

    Signed-off-by: Samuel Jero
    Acked-by: Gerrit Renker

    Samuel Jero
     
  • Add a check to prevent CCID-2 from increasing the cwnd greater than the
    Sequence Window.

    When the congestion window becomes bigger than the Sequence Window, CCID-2
    will attempt to keep more data in the network than the DCCP Sequence Window
    code considers possible. This results in the Sequence Window code issuing
    a Sync, thereby inducing needless overhead. Further, if this occurs at the
    sender, CCID-2 will never detect the problem because the Acks it receives
    will indicate no losses. I have seen this cause a drop of 1/3rd in throughput
    for a connection.

    Also add code to adjust the Sequence Window to be about 5 times the number of
    packets in the network (RFC 4340, 7.5.2) and to adjust the Ack Ratio so that
    the remote Sequence Window will hold about 5 times the number of packets in
    the network. This allows the congestion window to increase correctly without
    being limited by the Sequence Window.

    Signed-off-by: Samuel Jero
    Acked-by: Gerrit Renker

    Samuel Jero
     
  • This uses the new feature-negotiation framework to signal Ack Ratio changes,
    as required by RFC 4341, sec. 6.1.2.

    That raises some problems with CCID-2, which at the moment can not cope
    gracefully with Ack Ratios > 1. Since these issues are not directly related
    to feature negotiation, they are marked by a FIXME.

    Signed-off-by: Gerrit Renker
    Signed-off-by: Samuel Jero
    Acked-by: Ian McDonald

    Gerrit Renker
     

05 Jul, 2011

3 commits

  • CCID-2's cwnd increases like TCP during slow-start, which has implications for
    * the local Sequence Window value (should be > cwnd),
    * the Ack Ratio value.
    Hence an exponential growth, if it does not reflect the actual network
    conditions, can quickly lead to instability.

    This patch adds congestion-window validation (RFC2861) to CCID-2:
    * cwnd is constrained if the sender is application limited;
    * cwnd is reduced after a long idle period, as suggested in the '90 paper
    by Van Jacobson, in RFC 2581 (sec. 4.1);
    * cwnd is never reduced below the RFC 3390 initial window.

    As marked in the comments, the code is actually almost a direct copy of the
    TCP congestion-window-validation algorithms. By continuing this work, it may
    in future be possible to use the TCP code (not possible at the moment).

    The mechanism can be turned off using a module parameter. Sampling of the
    currently-used window (moving-maximum) is however done constantly; this is
    used to determine the expected window, which can be exploited to regulate
    DCCP's Sequence Window value.

    This patch also sets slow-start-after-idle (RFC 4341, 5.1), i.e. it behaves like
    TCP when net.ipv4.tcp_slow_start_after_idle = 1.

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     
  • This replaces a switch statement with a test, using the equivalent
    function dccp_data_packet(skb). It also doubles the range of the field
    `rx_num_data_pkts' by changing the type from `int' to `u32', avoiding
    signed/unsigned comparison with the u16 field `dccps_r_ack_ratio'.

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     
  • This moves CCID-2's initial window function into the header file, since several
    parts throughout the CCID-2 code need to call it (CCID-2 still uses RFC 3390).

    Signed-off-by: Gerrit Renker
    Acked-by: Leandro Melo de Sales

    Gerrit Renker
     

03 Feb, 2011

1 commit


15 Nov, 2010

1 commit

  • This patch replaces an almost identical replication of code: large parts
    of dccp_parse_options() re-appeared as ccid2_ackvector() in ccid2.c.

    Apart from the duplication, this caused two more problems:
    1. CCIDs should not need to be concerned with parsing header options;
    2. one can not assume that Ack Vectors appear as a contiguous area within an
    skb, it is legal to insert other options and/or padding in between. The
    current code would throw an error and stop reading in such a case.

    Since Ack Vectors provide CCID-specific information, they are now processed
    by the CCID directly, separating this functionality from the main DCCP code.

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     

11 Nov, 2010

1 commit

  • This patch brings the Ack Vector interface up to date. Its main purpose is
    to lay the basis for the subsequent patches of this set, which will use the
    new data structure fields and routines.

    There are no real algorithmic changes, rather an adaptation:

    (1) Replaced the static Ack Vector size (2) with a #define so that it can
    be adapted (with low loss / Ack Ratio, a value of 1 works, so 2 seems
    to be sufficient for the moment) and added a solution so that computing
    the ECN nonce will continue to work - even with larger Ack Vectors.

    (2) Replaced the #defines for Ack Vector states with a complete enum.

    (3) Replaced #defines to compute Ack Vector length and state with general
    purpose routines (inlines), and updated code to use these.

    (4) Added a `tail' field (conversion to circular buffer in subsequent patch).

    (5) Updated the (outdated) documentation for Ack Vector struct.

    (6) All sequence number containers now trimmed to 48 bits.

    (7) Removal of unused bits:
    * removed dccpav_ack_nonce from struct dccp_ackvec, since this is already
    redundantly stored in the `dccpavr_ack_nonce' (of Ack Vector record);
    * removed Elapsed Time for Ack Vectors (it was nowhere used);
    * replaced semantics of dccpavr_sent_len with dccpavr_ack_runlen, since
    the code needs to be able to remember the old run length;
    * reduced the de-/allocation routines (redundant / duplicate tests).

    Signed-off-by: Gerrit Renker

    Gerrit Renker