28 Feb, 2013

2 commits

  • 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
     
  • Convert to the much saner new idr interface.

    Signed-off-by: Tejun Heo
    Acked-by: Neil Horman
    Acked-by: Vlad Yasevich
    Cc: Sridhar Samudrala
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tejun Heo
     

22 Feb, 2013

1 commit

  • Pull trivial tree from Jiri Kosina:
    "Assorted tiny fixes queued in trivial tree"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (22 commits)
    DocBook: update EXPORT_SYMBOL entry to point at export.h
    Documentation: update top level 00-INDEX file with new additions
    ARM: at91/ide: remove unsused at91-ide Kconfig entry
    percpu_counter.h: comment code for better readability
    x86, efi: fix comment typo in head_32.S
    IB: cxgb3: delay freeing mem untill entirely done with it
    net: mvneta: remove unneeded version.h include
    time: x86: report_lost_ticks doesn't exist any more
    pcmcia: avoid static analysis complaint about use-after-free
    fs/jfs: Fix typo in comment : 'how may' -> 'how many'
    of: add missing documentation for of_platform_populate()
    btrfs: remove unnecessary cur_trans set before goto loop in join_transaction
    sound: soc: Fix typo in sound/codecs
    treewide: Fix typo in various drivers
    btrfs: fix comment typos
    Update ibmvscsi module name in Kconfig.
    powerpc: fix typo (utilties -> utilities)
    of: fix spelling mistake in comment
    h8300: Fix home page URL in h8300/README
    xtensa: Fix home page URL in Kconfig
    ...

    Linus Torvalds
     

19 Feb, 2013

3 commits

  • Pull in 'net' to take in the bug fixes that didn't make it into
    3.8-final.

    Also, deal with the semantic conflict of the change made to
    net/ipv6/xfrm6_policy.c A missing rt6->n neighbour release
    was added to 'net', but in 'net-next' we no longer cache the
    neighbour entries in the ipv6 routes so that change is not
    appropriate there.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • proc_net_remove is only used to remove proc entries
    that under /proc/net,it's not a general function for
    removing proc entries of netns. if we want to remove
    some proc entries which under /proc/net/stat/, we still
    need to call remove_proc_entry.

    this patch use remove_proc_entry to replace proc_net_remove.
    we can remove proc_net_remove after this patch.

    Signed-off-by: Gao feng
    Signed-off-by: David S. Miller

    Gao feng
     
  • Right now, some modules such as bonding use proc_create
    to create proc entries under /proc/net/, and other modules
    such as ipv4 use proc_net_fops_create.

    It looks a little chaos.this patch changes all of
    proc_net_fops_create to proc_create. we can remove
    proc_net_fops_create after this patch.

    Signed-off-by: Gao feng
    Signed-off-by: David S. Miller

    Gao feng
     

14 Feb, 2013

4 commits

  • In order to avoid any future surprises of kernel panics due to jprobes
    function mismatches (as e.g. fixed in 4cb9d6eaf85ecd: sctp: jsctp_sf_eat_sack:
    fix jprobes function signature mismatch), we should check both function
    types during build and scream loudly if they do not match. __same_type
    resolves to __builtin_types_compatible_p, which is 1 in case both types
    are the same and 0 otherwise, qualifiers are ignored. Tested by myself.

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

    Daniel Borkmann
     
  • The function jsctp_sf_eat_sack can be made static, no need to extend
    its visibility.

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

    Daniel Borkmann
     
  • This 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.

    Acked-by: Vlad Yasevich
    Acked-by: Steven Whitehouse
    Signed-off-by: Kees Cook
    Signed-off-by: David Rientjes
    Signed-off-by: David S. Miller

    Kees Cook
     
  • We walk through the bind address list and try to get the best source
    address for a given destination. However, currently, we take the
    'continue' path of the loop when an entry is invalid (!laddr->valid)
    *and* the entry state does not equal SCTP_ADDR_SRC (laddr->state !=
    SCTP_ADDR_SRC).

    Thus, still, invalid entries with SCTP_ADDR_SRC might not 'continue'
    as well as valid entries with SCTP_ADDR_{NEW, SRC, DEL}, with a possible
    false baddr and matchlen as a result, causing in worst case dst route
    to be false or possibly NULL.

    This test should actually be a '||' instead of '&&'. But lets fix it
    and make this a bit easier to read by having the condition the same way
    as similarly done in sctp_v4_get_dst.

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

    Daniel Borkmann
     

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

4 commits

  • Synchronize with 'net' in order to sort out some l2tp, wireless, and
    ipv6 GRE fixes that will be built on top of in 'net-next'.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • In sctp_auth_make_key_vector, we allocate a temporary sctp_auth_bytes
    structure with kmalloc instead of the sctp_auth_create_key allocator.
    Change this to sctp_auth_create_key as it is the case everywhere else,
    so that we also can properly free it via sctp_auth_key_put. This makes
    it easier for future code changes in the structure and allocator itself,
    since a single API is consistently used for this purpose. Also, by
    using sctp_auth_create_key we're doing sanity checks over the arguments.

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

    Daniel Borkmann
     
  • On sctp_endpoint_destroy, previously used sensitive keying material
    should be zeroed out before the memory is returned, as we already do
    with e.g. auth keys when released.

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

    Daniel Borkmann
     
  • In sctp_setsockopt_auth_key, we create a temporary copy of the user
    passed shared auth key for the endpoint or association and after
    internal setup, we free it right away. Since it's sensitive data, we
    should zero out the key before returning the memory back to the
    allocator. Thus, use kzfree instead of kfree, just as we do in
    sctp_auth_key_put().

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

    Daniel Borkmann
     

08 Feb, 2013

2 commits


05 Feb, 2013

2 commits

  • As in del_timer() there has already placed a timer_pending() function
    to check whether the timer to be deleted is pending or not, it's
    unnecessary to check timer pending state again before del_timer() is
    called.

    Signed-off-by: Ying Xue
    Cc: Eric Dumazet
    Signed-off-by: David S. Miller

    Ying Xue
     
  • It seems due to RCU usage, i.e. within SCTP's address binding list,
    a, say, ``behavioral change'' was introduced which does actually
    not conform to the RFC anymore. In particular consider the following
    (fictional) scenario to demonstrate this:

    do:
    Two SOCK_SEQPACKET-style sockets are opened (S1, S2)
    S1 is bound to 127.0.0.1, port 1024 [server]
    S2 is bound to 127.0.0.1, port 1025 [client]
    listen(2) is invoked on S1
    From S2 we call one sendmsg(2) with msg.msg_name and
    msg.msg_namelen parameters set to the server's
    address
    S1, S2 are closed
    goto do

    The first pass of this loop passes successful, while the second round
    fails during binding of S1 (address still in use). What is happening?
    In the first round, the initial handshake is being done, and, at the
    time close(2) is called on S1, a non-graceful shutdown is performed via
    ABORT since in S1's receive queue an unprocessed packet is present,
    thus stating an error condition. This can be considered as a correct
    behavior.

    During close also all bound addresses are freed, thus nothing *must*
    be active anymore. In reference to RFC2960:

    After checking the Verification Tag, the receiving endpoint shall
    remove the association from its record, and shall report the
    termination to its upper layer. (9.1 Abort of an Association)

    Also, no half-open states are supported, thus after an ungraceful
    shutdown, we leave nothing behind. However, this seems not to be
    happening though. In a real-world scenario, this is exactly where
    it breaks the lksctp-tools functional test suite, *for instance*:

    ./test_sockopt
    test_sockopt.c 1 PASS : getsockopt(SCTP_STATUS) on a socket with no assoc
    test_sockopt.c 2 PASS : getsockopt(SCTP_STATUS)
    test_sockopt.c 3 PASS : getsockopt(SCTP_STATUS) with invalid associd
    test_sockopt.c 4 PASS : getsockopt(SCTP_STATUS) with NULL associd
    test_sockopt.c 5 BROK : bind: Address already in use

    The underlying problem is that sctp_endpoint_destroy() hasn't been
    triggered yet while the next bind attempt is being done. It will be
    triggered eventually (but too late) by sctp_transport_destroy_rcu()
    after one RCU grace period:

    sctp_transport_destroy()
    sctp_transport_destroy_rcu() ----.
    sctp_association_put() [*] sctp_packet_free()
    sctp_association_destroy() [...]
    sctp_endpoint_put() skb->destructor
    sctp_endpoint_destroy() sctp_wfree()
    sctp_bind_addr_free() sctp_association_put() [*]

    Thus, we move out the condition with sctp_association_put() as well as
    the sctp_packet_free() invocation and the issue can be solved. We also
    better free the SCTP chunks first before putting the ref of the association.

    With this patch, the example above (which simulates a similar scenario
    as in the implementation of this test case) and therefore also the test
    suite run successfully through. Tested by myself.

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

    Daniel Borkmann
     

30 Jan, 2013

1 commit


29 Jan, 2013

1 commit


28 Jan, 2013

2 commits

  • Per-net sysctl table needs to be explicitly freed at
    net exit. Otherwise we see the following with kmemleak:

    unreferenced object 0xffff880402d08000 (size 2048):
    comm "chrome_sandbox", pid 18437, jiffies 4310887172 (age 9097.630s)
    hex dump (first 32 bytes):
    b2 68 89 81 ff ff ff ff 20 04 04 f8 01 88 ff ff .h...... .......
    04 00 00 00 a4 01 00 00 00 00 00 00 00 00 00 00 ................
    backtrace:
    [] kmemleak_alloc+0x21/0x3e
    [] slab_post_alloc_hook+0x28/0x2a
    [] __kmalloc_track_caller+0xf1/0x104
    [] kmemdup+0x1b/0x30
    [] sctp_sysctl_net_register+0x1f/0x72
    [] sctp_net_init+0x100/0x39f
    [] ops_init+0xc6/0xf5
    [] setup_net+0x4c/0xd0
    [] copy_net_ns+0x6d/0xd6
    [] create_new_namespaces+0xd7/0x147
    [] copy_namespaces+0x63/0x99
    [] copy_process+0xa65/0x1233
    [] do_fork+0x10b/0x271
    [] sys_clone+0x23/0x25
    [] stub_clone+0x13/0x20
    [] 0xffffffffffffffff

    I fixed the spelling of sysctl_header so the code actually
    compiles. -- EWB.

    Reported-by: Martin Mokrejs
    Signed-off-by: Vlad Yasevich
    Acked-by: Neil Horman
    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: David S. Miller

    Vlad Yasevich
     
  • While sctp handling a duplicate COOKIE-ECHO and the action is
    'Association restart', sctp_sf_do_dupcook_a() will processing
    the unexpected COOKIE-ECHO for peer restart, but it does not set
    the association state to SCTP_STATE_ESTABLISHED, so the association
    could stuck in SCTP_STATE_SHUTDOWN_PENDING state forever.
    This violates the sctp specification:
    RFC 4960 5.2.4. Handle a COOKIE ECHO when a TCB Exists
    Action
    A) In this case, the peer may have restarted. .....
    After this, the endpoint shall enter the ESTABLISHED state.

    To resolve this problem, adding a SCTP_CMD_NEW_STATE cmd to the
    command list before SCTP_CMD_REPLY cmd, this will set the restart
    association to SCTP_STATE_ESTABLISHED state properly and also avoid
    I-bit being set in the DATA chunk header when COOKIE_ACK is bundled
    with DATA chunks.

    Signed-off-by: Xufeng Zhang
    Acked-by: Neil Horman
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Xufeng Zhang
     

18 Jan, 2013

1 commit

  • Jamie Parsons reported a problem recently, in which the re-initalization of an
    association (The duplicate init case), resulted in a loss of receive window
    space. He tracked down the root cause to sctp_outq_teardown, which discarded
    all the data on an outq during a re-initalization of the corresponding
    association, but never reset the outq->outstanding_data field to zero. I wrote,
    and he tested this fix, which does a proper full re-initalization of the outq,
    fixing this problem, and hopefully future proofing us from simmilar issues down
    the road.

    Signed-off-by: Neil Horman
    Reported-by: Jamie Parsons
    Tested-by: Jamie Parsons
    CC: Jamie Parsons
    CC: Vlad Yasevich
    CC: "David S. Miller"
    CC: netdev@vger.kernel.org
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Neil Horman
     

16 Jan, 2013

1 commit


08 Jan, 2013

1 commit

  • Commit 0d0863b02002 ("sctp: Change defaults on cookie hmac selection")
    added a "choice" to the sctp Kconfig file. It introduced a bug which
    led to an infinite loop when while running "make oldconfig".

    The problem is that the wrong symbol was defined as the default value
    for the choice. Using the correct value gets rid of the infinite loop.

    Note: if CONFIG_SCTP_COOKIE_HMAC_SHA1=y was present in the input
    config file, both that and CONFIG_SCTP_COOKIE_HMAC_MD5=y be present
    in the generated config file.

    Signed-off-by: Alex Elder
    Signed-off-by: Linus Torvalds

    Alex Elder
     

03 Jan, 2013

1 commit


29 Dec, 2012

1 commit


16 Dec, 2012

2 commits

  • Commit 24cb81a6a (sctp: Push struct net down into all of the
    state machine functions) introduced the net structure into all
    state machine functions, but jsctp_sf_eat_sack was not updated,
    hence when SCTP association probing is enabled in the kernel,
    any simple SCTP client/server program from userspace will panic
    the kernel.

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

    Daniel Borkmann
     
  • Recently I posted commit 3c68198e75 which made selection of the cookie hmac
    algorithm selectable. This is all well and good, but Linus noted that it
    changes the default config:
    http://marc.info/?l=linux-netdev&m=135536629004808&w=2

    I've modified the sctp Kconfig file to reflect the recommended way of making
    this choice, using the thermal driver example specified, and brought the
    defaults back into line with the way they were prior to my origional patch

    Also, on Linus' suggestion, re-adding ability to select default 'none' hmac
    algorithm, so we don't needlessly bloat the kernel by forcing a non-none
    default. This also led me to note that we won't honor the default none
    condition properly because of how sctp_net_init is encoded. Fix that up as
    well.

    Tested by myself (allbeit fairly quickly). All configuration combinations seems
    to work soundly.

    Signed-off-by: Neil Horman
    CC: David Miller
    CC: Linus Torvalds
    CC: Vlad Yasevich
    CC: linux-sctp@vger.kernel.org
    Signed-off-by: David S. Miller

    Neil Horman
     

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
     

08 Dec, 2012

3 commits

  • peer.transport_addr_list is currently only protected by sk_sock
    which is inpractical to acquire for procfs dumping purposes.

    This patch adds RCU protection allowing for the procfs readers to
    enter RCU read-side critical sections.

    Modification of the list continues to be serialized via sk_lock.

    V2: Use list_del_rcu() in sctp_association_free() to be safe
    Skip transports marked dead when dumping for procfs

    Cc: Vlad Yasevich
    Cc: Neil Horman
    Signed-off-by: Thomas Graf
    Acked-by: Vlad Yasevich
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Thomas Graf
     
  • address_list is protected via the socket lock or RCU. Since we don't want
    to take the socket lock for each assoc we dump in procfs a RCU read-side
    critical section must be entered.

    V2: Skip local addresses marked as dead

    Cc: Vlad Yasevich
    Cc: Neil Horman
    Signed-off-by: Thomas Graf
    Acked-by: Vlad Yasevich
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Thomas Graf
     
  • WARNING: net/sctp/sctp.o(.text+0x72f1): Section mismatch in reference
    from the function sctp_net_init() to the function
    .init.text:sctp_proc_init()
    The function sctp_net_init() references
    the function __init sctp_proc_init().
    This is often because sctp_net_init lacks a __init
    annotation or the annotation of sctp_proc_init is wrong.

    And put __net_init after 'int' for sctp_proc_init - as it is done
    everywhere else in the sctp-stack.

    Signed-off-by: Christoph Paasch
    Acked-by: Neil Horman
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Christoph Paasch
     

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
     

01 Dec, 2012

2 commits

  • If the variable parameter length provided in the mandatory
    heartbeat information parameter exceeds the calculated payload
    length the packet has been corrupted. Reply with a parameter
    length protocol violation message.

    Signed-off-by: Thomas Graf
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Thomas Graf
     
  • Trinity (the syscall fuzzer) triggered the following BUG, reproducible
    only when the kernel is configured with CONFIG_SCTP_DBG_MSG=y.

    When CONFIG_SCTP_DBG_MSG is not set, the null pointer is never
    dereferenced.

    ---[ end trace a4de0bfcb38a3642 ]---
    BUG: unable to handle kernel NULL pointer dereference at 0000000000000100
    IP: [] ip6_string+0x1e/0xa0
    PGD 4eead067 PUD 4e472067 PMD 0
    Oops: 0000 [#1] PREEMPT SMP
    Modules linked in:
    CPU 3
    Pid: 21324, comm: trinity-child11 Tainted: G W 3.7.0-rc7+ #61 ASUSTeK Computer INC. EB1012/EB1012
    RIP: 0010:[] [] ip6_string+0x1e/0xa0
    RSP: 0018:ffff88004e4637a0 EFLAGS: 00010046
    RAX: ffff88004e4637da RBX: ffff88004e4637da RCX: 0000000000000000
    RDX: ffffffff8246e92a RSI: 0000000000000100 RDI: ffff88004e4637da
    RBP: ffff88004e4637a8 R08: 000000000000ffff R09: 000000000000ffff
    R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff8289d600
    R13: ffffffff8289d230 R14: ffffffff8246e928 R15: ffffffff8289d600
    FS: 00007fed95153700(0000) GS:ffff88005fd80000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000100 CR3: 000000004eeac000 CR4: 00000000000007e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process trinity-child11 (pid: 21324, threadinfo ffff88004e462000, task ffff8800524b0000)
    Stack:
    ffff88004e4637da ffff88004e463828 ffffffff81368eee 000000004e4637d8
    ffffffff0000ffff ffff88000000ffff 0000000000000000 000000004e4637f8
    ffffffff826285d8 ffff88004e4637f8 0000000000000000 ffff8800524b06b0
    Call Trace:
    [] ip6_addr_string.isra.11+0x3e/0xa0
    [] pointer.isra.12+0x233/0x2d0
    [] ? vprintk_emit+0x1ba/0x450
    [] ? trace_hardirqs_on_caller+0x10d/0x1a0
    [] vsnprintf+0x187/0x5d0
    [] vscnprintf+0x12/0x30
    [] vprintk_emit+0xa8/0x450
    [] printk+0x49/0x4b
    [] sctp_v6_get_dst+0x731/0x780
    [] ? sctp_v6_get_dst+0x325/0x780
    [] sctp_transport_route+0x46/0x120
    [] sctp_assoc_add_peer+0x161/0x350
    [] sctp_sendmsg+0x6cd/0xcb0
    [] ? inet_create+0x670/0x670
    [] inet_sendmsg+0x10b/0x220
    [] ? inet_create+0x670/0x670
    [] ? sock_update_classid+0xa4/0x2b0
    [] ? sock_update_classid+0xf0/0x2b0
    [] sock_sendmsg+0xdc/0xf0
    [] ? might_fault+0x85/0x90
    [] ? might_fault+0x3c/0x90
    [] sys_sendto+0xfa/0x130
    [] ? do_setitimer+0x197/0x380
    [] ? sysret_check+0x22/0x5d
    [] system_call_fastpath+0x16/0x1b
    Code: 01 eb 89 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 f8 31 c9 48 89 e5 53 eb 12 0f 1f 40 00 48 83 c1 01 48 83 c0 04 48 83 f9 08 74 70 b6 3c 4e 89 fb 83 e7 0f c0 eb 04 41 89 d8 41 83 e0 0f 0f b6
    RIP [] ip6_string+0x1e/0xa0
    RSP
    CR2: 0000000000000100
    ---[ end trace a4de0bfcb38a3643 ]---

    Signed-off-by: Tommi Rantala
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Tommi Rantala
     

30 Nov, 2012

1 commit


29 Nov, 2012

2 commits

  • The calculation of RTTVAR involves the subtraction of two unsigned
    numbers which
    may causes rollover and results in very high values of RTTVAR when RTT > SRTT.
    With this patch it is possible to set RTOmin = 1 to get the minimum of RTO at
    4 times the clock granularity.

    Change Notes:

    v2)
    *Replaced abs() by abs64() and long by __s64, changed patch
    description.

    Signed-off-by: Christian Schoch
    CC: Vlad Yasevich
    CC: Sridhar Samudrala
    CC: Neil Horman
    CC: linux-sctp@vger.kernel.org
    Acked-by: Vlad Yasevich
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Schoch Christian
     
  • Consider the following program, that sets the second argument to the
    sendto() syscall incorrectly:

    #include
    #include
    #include

    int main(void)
    {
    int fd;
    struct sockaddr_in sa;

    fd = socket(AF_INET, SOCK_STREAM, 132 /*IPPROTO_SCTP*/);
    if (fd < 0)
    return 1;

    memset(&sa, 0, sizeof(sa));
    sa.sin_family = AF_INET;
    sa.sin_addr.s_addr = inet_addr("127.0.0.1");
    sa.sin_port = htons(11111);

    sendto(fd, NULL, 1, 0, (struct sockaddr *)&sa, sizeof(sa));

    return 0;
    }

    We get -ENOMEM:

    $ strace -e sendto ./demo
    sendto(3, NULL, 1, 0, {sa_family=AF_INET, sin_port=htons(11111), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 ENOMEM (Cannot allocate memory)

    Propagate the error code from sctp_user_addto_chunk(), so that we will
    tell user space what actually went wrong:

    $ strace -e sendto ./demo
    sendto(3, NULL, 1, 0, {sa_family=AF_INET, sin_port=htons(11111), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EFAULT (Bad address)

    Noticed while running Trinity (the syscall fuzzer).

    Signed-off-by: Tommi Rantala
    Acked-by: Vlad Yasevich
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Tommi Rantala