25 Jul, 2012

2 commits

  • [ Upstream commit a06998b88b1651c5f71c0e35f528bf2057188ead ]

    We must prevent module unloading if some devices are still attached to
    l2tp_eth driver.

    Signed-off-by: Eric Dumazet
    Reported-by: Denys Fedoryshchenko
    Tested-by: Denys Fedoryshchenko
    Cc: James Chapman
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • [ Upstream commit cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc ]

    We need to validate the number of pages consumed by data_len, otherwise frags
    array could be overflowed by userspace. So this patch validate data_len and
    return -EMSGSIZE when data_len may occupies more frags than MAX_SKB_FRAGS.

    Signed-off-by: Jason Wang
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Jason Wang
     

20 Jul, 2012

1 commit

  • Remove linux/mm.h inclusion from netdevice.h -- it's unused (I've checked manually).

    To prevent mm.h inclusion via other channels also extract "enum dma_data_direction"
    definition into separate header. This tiny piece is what gluing netdevice.h with mm.h
    via "netdevice.h => dmaengine.h => dma-mapping.h => scatterlist.h => mm.h".
    Removal of mm.h from scatterlist.h was tried and was found not feasible
    on most archs, so the link was cutoff earlier.

    Hope people are OK with tiny include file.

    Note, that mm_types.h is still dragged in, but it is a separate story.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: David S. Miller

    Alexey Dobriyan
     

18 Jun, 2012

2 commits

  • commit 463454b5dbd8dbab6e2fc6c557329e5b811b9c32 upstream.

    If a given interface combination doesn't contain
    a required interface type then we missed checking
    that and erroneously allowed it even though iface
    type wasn't there at all. Add a check that makes
    sure that all interface types are accounted for.

    Reported-by: Mohammed Shafi Shajakhan
    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • commit 71ecfa1893034eeb1c93e02e22ee2ad26d080858 upstream.

    When any interface goes down, it could be the one that we
    were doing a remain-on-channel with. We therefore need to
    cancel the remain-on-channel and flush the related work
    structs so they don't run after the interface has been
    removed or even destroyed.

    It's also possible in this case that an off-channel SKB
    was never transmitted, so free it if this is the case.
    Note that this can also happen if the driver finishes
    the off-channel period without ever starting it.

    Reported-by: Nirav Shah
    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     

09 Jun, 2012

10 commits

  • [ Upstream commit 91657eafb64b4cb53ec3a2fbc4afc3497f735788 ]

    Corrects the function that determines the esp payload size. The calculations
    done in esp{4,6}_get_mtu() lead to overlength frames in transport mode for
    certain mtu values and suboptimal frames for others.

    According to what is done, mainly in esp{,6}_output() and tcp_mtu_to_mss(),
    net_header_len must be taken into account before doing the alignment
    calculation.

    Signed-off-by: Benjamin Poirier
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Benjamin Poirier
     
  • [ Upstream commit e0268868ba064980488fc8c194db3d8e9fb2959c ]

    dst_check() will take care of SA (and obsolete field), hence
    IPsec rekeying scenario is taken into account.

    Signed-off-by: Nicolas Dichtel
    Acked-by: Vlad Yaseivch
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Nicolas Dichtel
     
  • [ Upstream commit 59b9997baba5242997ddc7bd96b1391f5275a5a4 ]

    This reverts commit 8a83a00b0735190384a348156837918271034144.

    It causes regressions for S390 devices, because it does an
    unconditional DST drop on SKBs for vlans and the QETH device
    needs the neighbour entry hung off the DST for certain things
    on transmit.

    Arnd can't remember exactly why he even needed this change.

    Conflicts:

    drivers/net/macvlan.c
    net/8021q/vlan_dev.c
    net/core/dev.c

    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    David S. Miller
     
  • [ Upstream commit d4b1133558e0d417342d5d2c49e4c35b428ff20d ]

    commit c57b5468406 (pktgen: fix crash at module unload) did a very poor
    job with list primitives.

    1) list_splice() arguments were in the wrong order

    2) list_splice(list, head) has undefined behavior if head is not
    initialized.

    3) We should use the list_splice_init() variant to clear pktgen_threads
    list.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • [ Upstream commit c57b54684060c8aced64a5b78ff69ff289af97b9 ]

    commit 7d3d43dab4e9 (net: In unregister_netdevice_notifier unregister
    the netdevices.) makes pktgen crashing at module unload.

    [ 296.820578] BUG: spinlock bad magic on CPU#6, rmmod/3267
    [ 296.820719] lock: ffff880310c38000, .magic: ffff8803, .owner: /-1, .owner_cpu: -1
    [ 296.820943] Pid: 3267, comm: rmmod Not tainted 3.4.0-rc5+ #254
    [ 296.821079] Call Trace:
    [ 296.821211] [] spin_dump+0x8a/0x8f
    [ 296.821345] [] spin_bug+0x21/0x26
    [ 296.821507] [] do_raw_spin_lock+0x131/0x140
    [ 296.821648] [] _raw_spin_lock+0x1e/0x20
    [ 296.821786] [] __pktgen_NN_threads+0x4d/0x140 [pktgen]
    [ 296.821928] [] pktgen_device_event+0x10d/0x1e0 [pktgen]
    [ 296.822073] [] unregister_netdevice_notifier+0x7f/0x100
    [ 296.822216] [] pg_cleanup+0x48/0x73 [pktgen]
    [ 296.822357] [] sys_delete_module+0x17e/0x2a0
    [ 296.822502] [] system_call_fastpath+0x16/0x1b

    Hold the pktgen_thread_lock while splicing pktgen_threads, and test
    pktgen_exiting in pktgen_device_event() to make unload faster.

    Signed-off-by: Eric Dumazet
    Cc: Eric W. Biederman
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • [ Upstream commit c51ce49735c183ef2592db70f918ee698716276b ]

    An application may call connect() to disconnect a socket using an
    address with family AF_UNSPEC. The L2TP IP sockets were not handling
    this case when the socket is not bound and an attempt to connect()
    using AF_UNSPEC in such cases would result in an oops. This patch
    addresses the problem by protecting the sk_prot->disconnect() call
    against trying to unhash the socket before it is bound.

    The patch also adds more checks that the sockaddr supplied to bind()
    and connect() calls is valid.

    RIP: 0010:[] [] inet_unhash+0x50/0xd0
    RSP: 0018:ffff88001989be28 EFLAGS: 00010293
    Stack:
    ffff8800407a8000 0000000000000000 ffff88001989be78 ffffffff82e3a249
    ffffffff82e3a050 ffff88001989bec8 ffff88001989be88 ffff8800407a8000
    0000000000000010 ffff88001989bec8 ffff88001989bea8 ffffffff82e42639
    Call Trace:
    [] udp_disconnect+0x1f9/0x290
    [] inet_dgram_connect+0x29/0x80
    [] sys_connect+0x9c/0x100

    Reported-by: Sasha Levin
    Signed-off-by: James Chapman
    Signed-off-by: Greg Kroah-Hartman

    James Chapman
     
  • [ Upstream commit 0c1833797a5a6ec23ea9261d979aa18078720b74 ]

    Since commit ad0081e43a
    "ipv6: Fragment locally generated tunnel-mode IPSec6 packets as needed"
    the fragment of packets is incorrect.
    because tunnel mode needs IPsec headers and trailer for all fragments,
    while on transport mode it is sufficient to add the headers to the
    first fragment and the trailer to the last.

    so modify mtu and maxfraglen base on ipsec mode and if fragment is first
    or last.

    with my test,it work well(every fragment's size is the mtu)
    and does not trigger slow fragment path.

    Changes from v1:
    though optimization, mtu_prev and maxfraglen_prev can be delete.
    replace xfrm mode codes with dst_entry's new frag DST_XFRM_TUNNEL.
    add fuction ip6_append_data_mtu to make codes clearer.

    Signed-off-by: Gao feng
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Gao feng
     
  • [ Upstream commit e49cc0da7283088c5e03d475ffe2fdcb24a6d5b1 ]

    We hit a kernel OOPS.

    [23898.789643] BUG: sleeping function called from invalid context at
    /data/buildbot/workdir/ics/hardware/intel/linux-2.6/arch/x86/mm/fault.c:1103
    [23898.862215] in_atomic(): 0, irqs_disabled(): 0, pid: 10526, name:
    Thread-6683
    [23898.967805] HSU serial 0000:00:05.1: 0000:00:05.2:HSU serial prevented me
    to suspend...
    [23899.258526] Pid: 10526, comm: Thread-6683 Tainted: G W
    3.0.8-137685-ge7742f9 #1
    [23899.357404] HSU serial 0000:00:05.1: 0000:00:05.2:HSU serial prevented me
    to suspend...
    [23899.904225] Call Trace:
    [23899.989209] [] ? pgtable_bad+0x130/0x130
    [23900.000416] [] __might_sleep+0x10a/0x110
    [23900.007357] [] do_page_fault+0xd1/0x3c0
    [23900.013764] [] ? restore_all+0xf/0xf
    [23900.024024] [] ? napi_complete+0x8b/0x690
    [23900.029297] [] ? pgtable_bad+0x130/0x130
    [23900.123739] [] ? pgtable_bad+0x130/0x130
    [23900.128955] [] error_code+0x5f/0x64
    [23900.133466] [] ? pgtable_bad+0x130/0x130
    [23900.138450] [] ? __ip_route_output_key+0x698/0x7c0
    [23900.144312] [] ? __ip_route_output_key+0x38d/0x7c0
    [23900.150730] [] ip_route_output_flow+0x1f/0x60
    [23900.156261] [] ip4_datagram_connect+0x188/0x2b0
    [23900.161960] [] ? _raw_spin_unlock_bh+0x1f/0x30
    [23900.167834] [] inet_dgram_connect+0x36/0x80
    [23900.173224] [] ? _copy_from_user+0x48/0x140
    [23900.178817] [] sys_connect+0x9a/0xd0
    [23900.183538] [] ? alloc_file+0xdc/0x240
    [23900.189111] [] ? sub_preempt_count+0x3d/0x50

    Function free_fib_info resets nexthop_nh->nh_dev to NULL before releasing
    fi. Other cpu might be accessing fi. Fixing it by delaying the releasing.

    With the patch, we ran MTBF testing on Android mobile for 12 hours
    and didn't trigger the issue.

    Thank Eric for very detailed review/checking the issue.

    Signed-off-by: Yanmin Zhang
    Signed-off-by: Kun Jiang
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Yanmin Zhang
     
  • [ Upstream commit dccd9ecc374462e5d6a5b8f8110415a86c2213d8 ]

    Due to RCU lookups and RCU based release, fib_info objects can
    be found during lookup which have fi->fib_dead set.

    We must ignore these entries, otherwise we risk dereferencing
    the parts of the entry which are being torn down.

    Reported-by: Yevgen Pronenko
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    David S. Miller
     
  • commit 7b21aea04d084916ac4e0e8852dcc9cd60ec0d1d upstream.

    WLAN_STA_BLOCK_BA is set while suspending but doesn't get cleared
    when resuming in case of wowlan. This causes further ADDBA requests
    received to be rejected. Fix it by clearing it in the wowlan path
    as well.

    Signed-off-by: Eyal Shapira
    Reviewed-by: Johannes Berg
    Signed-off-by: John W. Linville
    Signed-off-by: Greg Kroah-Hartman

    Eyal Shapira
     

01 Jun, 2012

1 commit

  • commit 80007efeff0568375b08faf93c7aad65602cb97e upstream.

    It has happened twice now where elaborate troubleshooting has
    undergone on systems where CONFIG_CFG80211_INTERNAL_REGDB [0]
    has been set but yet net/wireless/db.txt was not updated.

    Despite the documentation on this it seems system integrators could
    use some more help with this, so throw out a kernel warning at boot time
    when their database is empty.

    This does mean that the error-prone system integrator won't likely
    realize the issue until they boot the machine but -- it does not seem
    to make sense to enable a build bug breaking random build testing.

    [0] http://wireless.kernel.org/en/developers/Regulatory/CRDA#CONFIG_CFG80211_INTERNAL_REGDB

    Cc: Stephen Rothwell
    Cc: Youngsin Lee
    Cc: Raja Mani
    Cc: Senthil Kumar Balasubramanian
    Cc: Vipin Mehta
    Cc: yahuan@qca.qualcomm.com
    Cc: jjan@qca.qualcomm.com
    Cc: vthiagar@qca.qualcomm.com
    Cc: henrykim@qualcomm.com
    Cc: jouni@qca.qualcomm.com
    Cc: athiruve@qca.qualcomm.com
    Cc: cjkim@qualcomm.com
    Cc: philipk@qca.qualcomm.com
    Cc: sunnykim@qualcomm.com
    Cc: sskwak@qualcomm.com
    Cc: kkim@qualcomm.com
    Cc: mattbyun@qualcomm.com
    Cc: ryanlee@qualcomm.com
    Cc: simbap@qualcomm.com
    Cc: krislee@qualcomm.com
    Cc: conner@qualcomm.com
    Cc: hojinkim@qualcomm.com
    Cc: honglee@qualcomm.com
    Cc: johnwkim@qualcomm.com
    Cc: jinyong@qca.qualcomm.com
    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: John W. Linville
    Signed-off-by: Greg Kroah-Hartman

    Luis R. Rodriguez
     

22 May, 2012

5 commits

  • commit bad115cfe5b509043b684d3a007ab54b80090aa1 upstream.

    Since recent changes on TCP splicing (starting with commits 2f533844
    "tcp: allow splice() to build full TSO packets" and 35f9c09f "tcp:
    tcp_sendpages() should call tcp_push() once"), I started seeing
    massive stalls when forwarding traffic between two sockets using
    splice() when pipe buffers were larger than socket buffers.

    Latest changes (net: netdev_alloc_skb() use build_skb()) made the
    problem even more apparent.

    The reason seems to be that if do_tcp_sendpages() fails on out of memory
    condition without being able to send at least one byte, tcp_push() is not
    called and the buffers cannot be flushed.

    After applying the attached patch, I cannot reproduce the stalls at all
    and the data rate it perfectly stable and steady under any condition
    which previously caused the problem to be permanent.

    The issue seems to have been there since before the kernel migrated to
    git, which makes me think that the stalls I occasionally experienced
    with tux during stress-tests years ago were probably related to the
    same issue.

    This issue was first encountered on 3.0.31 and 3.2.17, so please backport
    to -stable.

    Signed-off-by: Willy Tarreau
    Acked-by: Eric Dumazet
    Signed-off-by: Greg Kroah-Hartman

    Willy Tarreau
     
  • [ Upstream commit b49960a05e32121d29316cfdf653894b88ac9190 ]

    tcp_adv_win_scale default value is 2, meaning we expect a good citizen
    skb to have skb->len / skb->truesize ratio of 75% (3/4)

    In 2.6 kernels we (mis)accounted for typical MSS=1460 frame :
    1536 + 64 + 256 = 1856 'estimated truesize', and 1856 * 3/4 = 1392.
    So these skbs were considered as not bloated.

    With recent truesize fixes, a typical MSS=1460 frame truesize is now the
    more precise :
    2048 + 256 = 2304. But 2304 * 3/4 = 1728.
    So these skb are not good citizen anymore, because 1460 < 1728

    (GRO can escape this problem because it build skbs with a too low
    truesize.)

    This also means tcp advertises a too optimistic window for a given
    allocated rcvspace : When receiving frames, sk_rmem_alloc can hit
    sk_rcvbuf limit and we call tcp_prune_queue()/tcp_collapse() too often,
    especially when application is slow to drain its receive queue or in
    case of losses (netperf is fast, scp is slow). This is a major latency
    source.

    We should adjust the len/truesize ratio to 50% instead of 75%

    This patch :

    1) changes tcp_adv_win_scale default to 1 instead of 2

    2) increase tcp_rmem[2] limit from 4MB to 6MB to take into account
    better truesize tracking and to allow autotuning tcp receive window to
    reach same value than before. Note that same amount of kernel memory is
    consumed compared to 2.6 kernels.

    Signed-off-by: Eric Dumazet
    Cc: Neal Cardwell
    Cc: Tom Herbert
    Cc: Yuchung Cheng
    Acked-by: Neal Cardwell
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • [ Upstream commit 84768edbb2721637620b2d84501bb0d5aed603f1 ]

    l2tp_ip_sendmsg could return without releasing socket lock, making it all the
    way to userspace, and generating the following warning:

    [ 130.891594] ================================================
    [ 130.894569] [ BUG: lock held when returning to user space! ]
    [ 130.897257] 3.4.0-rc5-next-20120501-sasha #104 Tainted: G W
    [ 130.900336] ------------------------------------------------
    [ 130.902996] trinity/8384 is leaving the kernel with locks still held!
    [ 130.906106] 1 lock held by trinity/8384:
    [ 130.907924] #0: (sk_lock-AF_INET){+.+.+.}, at: [] l2tp_ip_sendmsg+0x2f/0x550

    Introduced by commit 2f16270 ("l2tp: Fix locking in l2tp_ip.c").

    Signed-off-by: Sasha Levin
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Sasha Levin
     
  • [ Upstream commit 7d3d43dab4e978d8d9ad1acf8af15c9b1c4b0f0f ]

    We already synthesize events in register_netdevice_notifier and synthesizing
    events in unregister_netdevice_notifier allows to us remove the need for
    special case cleanup code.

    This change should be safe as it adds no new cases for existing callers
    of unregiser_netdevice_notifier to handle.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • [ Upstream commit 116a0fc31c6c9b8fc821be5a96e5bf0b43260131 ]

    skb_checksum_help(skb) can return an error, we must free skb in this
    case. qdisc_drop(skb, sch) can also be feeded with a NULL skb (if
    skb_unshare() failed), so lets use this generic helper.

    Signed-off-by: Eric Dumazet
    Cc: Stephen Hemminger
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     

07 May, 2012

2 commits

  • commit 66f2c99af3d6f2d0aa1120884cf1c60613ef61c0 upstream.

    EAP frames for stations in an AP VLAN are sent on the main AP interface
    to avoid race conditions wrt. moving stations.
    For that to work properly, sta_info_get_bss must be used instead of
    sta_info_get when sending EAP packets.
    Previously this was only done for cooked monitor injected packets, so
    this patch adds a check for tx->skb->protocol to the same place.

    Signed-off-by: Felix Fietkau
    Signed-off-by: John W. Linville
    Signed-off-by: Greg Kroah-Hartman

    Felix Fietkau
     
  • commit 2b5f8b0b44e17e625cfba1e7b88db44f4dcc0441 upstream.
    [backported by Ben Greear]

    The nl80211 handling code should ensure as much as
    it can that the interface is in a valid state, it
    can certainly ensure the interface is running.

    Not doing so can cause calls through mac80211 into
    the driver that result in warnings and unspecified
    behaviour in the driver.

    Reported-by: Ben Greear
    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville
    Signed-off-by: Ben Greear
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     

28 Apr, 2012

14 commits

  • [ Upstream commit d135c522f1234f62e81be29cebdf59e9955139ad ]

    Commit f5fff5d forgot to fix TCP_MAXSEG behavior IPv6 sockets, so IPv6
    TCP server sockets that used TCP_MAXSEG would find that the advmss of
    child sockets would be incorrect. This commit mirrors the advmss logic
    from tcp_v4_syn_recv_sock in tcp_v6_syn_recv_sock. Eventually this
    logic should probably be shared between IPv4 and IPv6, but this at
    least fixes this issue.

    Signed-off-by: Neal Cardwell
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Neal Cardwell
     
  • [ Upstream commit 3adadc08cc1e2cbcc15a640d639297ef5fcb17f5 ]

    While reviewing the sysctl code in ax25 I spotted races in ax25_exit
    where it is possible to receive notifications and packets after already
    freeing up some of the data structures needed to process those
    notifications and updates.

    Call unregister_netdevice_notifier early so that the rest of the cleanup
    code does not need to deal with network devices. This takes advantage
    of my recent enhancement to unregister_netdevice_notifier to send
    unregister notifications of all network devices that are current
    registered.

    Move the unregistration for packet types, socket types and protocol
    types before we cleanup any of the ax25 data structures to remove the
    possibilities of other races.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • [ Upstream commit b922934d017f1cc831b017913ed7d1a56c558b43 ]

    ops_init should free the net_generic data on
    init failure and __register_pernet_operations should not
    call ops_free when NET_NS is not enabled.

    Signed-off-by: Julian Anastasov
    Reviewed-by: "Eric W. Biederman"
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Julian Anastasov
     
  • [ Upstream commit 4d846f02392a710f9604892ac3329e628e60a230 ]

    tcp_grow_window() has to grow rcv_ssthresh up to window_clamp, allowing
    sender to increase its window.

    tcp_grow_window() still assumes a tcp frame is under MSS, but its no
    longer true with LRO/GRO.

    This patch fixes one of the performance issue we noticed with GRO on.

    Signed-off-by: Eric Dumazet
    Cc: Neal Cardwell
    Cc: Tom Herbert
    Acked-by: Neal Cardwell
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • [ Upstream commit 244b65dbfede788f2fa3fe2463c44d0809e97c6b ]

    A parameter set exists for WRED mode, called wred_set, to hold the same
    values for qavg and qidlestart across all VQs. The WRED mode values had
    been previously held in the VQ for the default DP. After these values
    were moved to wred_set, the VQ for the default DP was no longer created
    automatically (so that it could be omitted on purpose, to have packets
    in the default DP enqueued directly to the device without using RED).

    However, gred_dump() was overlooked during that change; in WRED mode it
    still reads qavg/qidlestart from the VQ for the default DP, which might
    not even exist. As a result, this command sequence will cause an oops:

    tc qdisc add dev $DEV handle $HANDLE parent $PARENT gred setup \
    DPs 3 default 2 grio
    tc qdisc change dev $DEV handle $HANDLE gred DP 0 prio 8 $RED_OPTIONS
    tc qdisc change dev $DEV handle $HANDLE gred DP 1 prio 8 $RED_OPTIONS

    This fixes gred_dump() in WRED mode to use the values held in wred_set.

    Signed-off-by: David Ward
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    David Ward
     
  • [ Upstream commit 18a223e0b9ec8979320ba364b47c9772391d6d05 ]

    Fix a code path in tcp_rcv_rtt_update() that was comparing scaled and
    unscaled RTT samples.

    The intent in the code was to only use the 'm' measurement if it was a
    new minimum. However, since 'm' had not yet been shifted left 3 bits
    but 'new_sample' had, this comparison would nearly always succeed,
    leading us to erroneously set our receive-side RTT estimate to the 'm'
    sample when that sample could be nearly 8x too high to use.

    The overall effect is to often cause the receive-side RTT estimate to
    be significantly too large (up to 40% too large for brief periods in
    my tests).

    Signed-off-by: Neal Cardwell
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Neal Cardwell
     
  • [ Upstream commit 110c43304db6f06490961529536c362d9ac5732f ]

    As soon as an skb is queued into socket error queue, another thread
    can consume it, so we are not allowed to reference skb anymore, or risk
    use after free.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • [ Upstream commit 4a7e7c2ad540e54c75489a70137bf0ec15d3a127 ]

    As soon as an skb is queued into socket receive_queue, another thread
    can consume it, so we are not allowed to reference skb anymore, or risk
    use after free.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • [ Upstream commit bcf1b70ac6eb0ed8286c66e6bf37cb747cbaa04c ]

    A phonet packet is limited to USHRT_MAX bytes, this is never checked during
    tx which means that the user can specify any size he wishes, and the kernel
    will attempt to allocate that size.

    In the good case, it'll lead to the following warning, but it may also cause
    the kernel to kick in the OOM and kill a random task on the server.

    [ 8921.744094] WARNING: at mm/page_alloc.c:2255 __alloc_pages_slowpath+0x65/0x730()
    [ 8921.749770] Pid: 5081, comm: trinity Tainted: G W 3.4.0-rc1-next-20120402-sasha #46
    [ 8921.756672] Call Trace:
    [ 8921.758185] [] warn_slowpath_common+0x87/0xb0
    [ 8921.762868] [] warn_slowpath_null+0x15/0x20
    [ 8921.765399] [] __alloc_pages_slowpath+0x65/0x730
    [ 8921.769226] [] ? zone_watermark_ok+0x1a/0x20
    [ 8921.771686] [] ? get_page_from_freelist+0x625/0x660
    [ 8921.773919] [] __alloc_pages_nodemask+0x1f8/0x240
    [ 8921.776248] [] kmalloc_large_node+0x70/0xc0
    [ 8921.778294] [] __kmalloc_node_track_caller+0x34/0x1c0
    [ 8921.780847] [] ? sock_alloc_send_pskb+0xbc/0x260
    [ 8921.783179] [] __alloc_skb+0x75/0x170
    [ 8921.784971] [] sock_alloc_send_pskb+0xbc/0x260
    [ 8921.787111] [] ? release_sock+0x7e/0x90
    [ 8921.788973] [] sock_alloc_send_skb+0x10/0x20
    [ 8921.791052] [] pep_sendmsg+0x60/0x380
    [ 8921.792931] [] ? pn_socket_bind+0x156/0x180
    [ 8921.794917] [] ? pn_socket_autobind+0x3f/0x90
    [ 8921.797053] [] pn_socket_sendmsg+0x4f/0x70
    [ 8921.798992] [] sock_aio_write+0x187/0x1b0
    [ 8921.801395] [] ? sub_preempt_count+0xae/0xf0
    [ 8921.803501] [] ? __lock_acquire+0x42c/0x4b0
    [ 8921.805505] [] ? __sock_recv_ts_and_drops+0x140/0x140
    [ 8921.807860] [] do_sync_readv_writev+0xbc/0x110
    [ 8921.809986] [] ? might_fault+0x97/0xa0
    [ 8921.811998] [] ? security_file_permission+0x1e/0x90
    [ 8921.814595] [] do_readv_writev+0xe2/0x1e0
    [ 8921.816702] [] ? do_setitimer+0x1ac/0x200
    [ 8921.818819] [] ? get_parent_ip+0x11/0x50
    [ 8921.820863] [] ? sub_preempt_count+0xae/0xf0
    [ 8921.823318] [] vfs_writev+0x46/0x60
    [ 8921.825219] [] sys_writev+0x4f/0xb0
    [ 8921.827127] [] system_call_fastpath+0x16/0x1b
    [ 8921.829384] ---[ end trace dffe390f30db9eb7 ]---

    Signed-off-by: Sasha Levin
    Acked-by: Rémi Denis-Courmont
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Sasha Levin
     
  • [ Upstream commit 78d50217baf36093ab320f95bae0d6452daec85c ]

    Convert array index from the loop bound to the loop index.

    And remove the void type conversion to ip6_mc_del1_src() return
    code, seem it is unnecessary, since ip6_mc_del1_src() does not
    use __must_check similar attribute, no compiler will report the
    warning when it is removed.

    v2: enrich the commit header

    Signed-off-by: RongQing.Li
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    RongQing.Li
     
  • [ Upstream commit 996304bbea3d2a094b7ba54c3bd65d3fffeac57b ]

    As it stands the bridge IGMP snooping system will respond to
    group leave messages with queries for remaining membership.
    This is both unnecessary and undesirable. First of all any
    multicast routers present should be doing this rather than us.
    What's more the queries that we send may end up upsetting other
    multicast snooping swithces in the system that are buggy.

    In fact, we can simply remove the code that send these queries
    because the existing membership expiry mechanism doesn't rely
    on them anyway.

    So this patch simply removes all code associated with group
    queries in response to group leave messages.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Herbert Xu
     
  • [ Upstream commit acdd5985364f8dc511a0762fab2e683f29d9d692 ]

    getsockopt(..., SCTP_EVENTS, ...) performs a length check and returns
    an error if the user provides less bytes than the size of struct
    sctp_event_subscribe.

    Struct sctp_event_subscribe needs to be extended by an u8 for every
    new event or notification type that is added.

    This obviously makes getsockopt fail for binaries that are compiled
    against an older versions of which do not contain
    all event types.

    This patch changes getsockopt behaviour to no longer return an error
    if not enough bytes are being provided by the user. Instead, it
    returns as much of sctp_event_subscribe as fits into the provided buffer.

    This leads to the new behavior that users see what they have been aware
    of at compile time.

    The setsockopt(..., SCTP_EVENTS, ...) API is already behaving like this.

    Signed-off-by: Thomas Graf
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Thomas Graf
     
  • [ This combines upstream commit
    2f53384424251c06038ae612e56231b96ab610ee and the follow-on bug fix
    commit 35f9c09fe9c72eb8ca2b8e89a593e1c151f28fc2 ]

    vmsplice()/splice(pipe, socket) call do_tcp_sendpages() one page at a
    time, adding at most 4096 bytes to an skb. (assuming PAGE_SIZE=4096)

    The call to tcp_push() at the end of do_tcp_sendpages() forces an
    immediate xmit when pipe is not already filled, and tso_fragment() try
    to split these skb to MSS multiples.

    4096 bytes are usually split in a skb with 2 MSS, and a remaining
    sub-mss skb (assuming MTU=1500)

    This makes slow start suboptimal because many small frames are sent to
    qdisc/driver layers instead of big ones (constrained by cwnd and packets
    in flight of course)

    In fact, applications using sendmsg() (adding an additional memory copy)
    instead of vmsplice()/splice()/sendfile() are a bit faster because of
    this anomaly, especially if serving small files in environments with
    large initial [c]wnd.

    Call tcp_push() only if MSG_MORE is not set in the flags parameter.

    This bit is automatically provided by splice() internals but for the
    last page, or on all pages if user specified SPLICE_F_MORE splice()
    flag.

    In some workloads, this can reduce number of sent logical packets by an
    order of magnitude, making zero-copy TCP actually faster than
    one-copy :)

    Reported-by: Tom Herbert
    Cc: Nandita Dukkipati
    Cc: Neal Cardwell
    Cc: Tom Herbert
    Cc: Yuchung Cheng
    Cc: H.K. Jerry Chu
    Cc: Maciej Żenczykowski
    Cc: Mahesh Bandewar
    Cc: Ilpo Järvinen
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • commit e55a4046dab28c440c96890bdddcf02dc8981f2d upstream.

    Signed-off-by: Lukasz Kucharczyk
    Signed-off-by: John W. Linville
    Signed-off-by: Greg Kroah-Hartman

    Lukasz Kucharczyk
     

23 Apr, 2012

1 commit

  • commit 94324962066231a938564bebad0f941cd2d06bb2 upstream.

    Make sure hci_dev_open returns immediately if hci_dev_unregister has
    been called.

    This fixes a race between hci_dev_open and hci_dev_unregister which can
    lead to a NULL-pointer dereference.

    Bug is 100% reproducible using hciattach and a disconnected serial port:

    0. # hciattach -n /dev/ttyO1 any noflow

    1. hci_dev_open called from hci_power_on grabs req lock
    2. hci_init_req executes but device fails to initialise (times out
    eventually)
    3. hci_dev_open is called from hci_sock_ioctl and sleeps on req lock
    4. hci_uart_tty_close calls hci_dev_unregister and sleeps on req lock in
    hci_dev_do_close
    5. hci_dev_open (1) releases req lock
    6. hci_dev_do_close grabs req lock and returns as device is not up
    7. hci_dev_unregister sleeps in destroy_workqueue
    8. hci_dev_open (3) grabs req lock, calls hci_init_req and eventually sleeps
    9. hci_dev_unregister finishes, while hci_dev_open is still running...

    [ 79.627136] INFO: trying to register non-static key.
    [ 79.632354] the code is fine but needs lockdep annotation.
    [ 79.638122] turning off the locking correctness validator.
    [ 79.643920] [] (unwind_backtrace+0x0/0xf8) from [] (__lock_acquire+0x1590/0x1ab0)
    [ 79.653594] [] (__lock_acquire+0x1590/0x1ab0) from [] (lock_acquire+0x9c/0x128)
    [ 79.663085] [] (lock_acquire+0x9c/0x128) from [] (run_timer_softirq+0x150/0x3ac)
    [ 79.672668] [] (run_timer_softirq+0x150/0x3ac) from [] (__do_softirq+0xd4/0x22c)
    [ 79.682281] [] (__do_softirq+0xd4/0x22c) from [] (irq_exit+0x8c/0x94)
    [ 79.690856] [] (irq_exit+0x8c/0x94) from [] (handle_IRQ+0x34/0x84)
    [ 79.699157] [] (handle_IRQ+0x34/0x84) from [] (omap3_intc_handle_irq+0x48/0x4c)
    [ 79.708648] [] (omap3_intc_handle_irq+0x48/0x4c) from [] (__irq_usr+0x3c/0x60)
    [ 79.718048] Exception stack(0xcf281fb0 to 0xcf281ff8)
    [ 79.723358] 1fa0: 0001e6a0 be8dab00 0001e698 00036698
    [ 79.731933] 1fc0: 0002df98 0002df38 0000001f 00000000 b6f234d0 00000000 00000004 00000000
    [ 79.740509] 1fe0: 0001e6f8 be8d6aa0 be8dac50 0000aab8 80000010 ffffffff
    [ 79.747497] Unable to handle kernel NULL pointer dereference at virtual address 00000000
    [ 79.756011] pgd = cf3b4000
    [ 79.758850] [00000000] *pgd=8f0c7831, *pte=00000000, *ppte=00000000
    [ 79.765502] Internal error: Oops: 80000007 [#1]
    [ 79.770294] Modules linked in:
    [ 79.773529] CPU: 0 Tainted: G W (3.3.0-rc6-00002-gb5d5c87 #421)
    [ 79.781066] PC is at 0x0
    [ 79.783721] LR is at run_timer_softirq+0x16c/0x3ac
    [ 79.788787] pc : [] lr : [] psr: 60000113
    [ 79.788787] sp : cf281ee0 ip : 00000000 fp : cf280000
    [ 79.800903] r10: 00000004 r9 : 00000100 r8 : b6f234d0
    [ 79.806427] r7 : c0519c28 r6 : cf093488 r5 : c0561a00 r4 : 00000000
    [ 79.813323] r3 : 00000000 r2 : c054eee0 r1 : 00000001 r0 : 00000000
    [ 79.820190] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
    [ 79.827728] Control: 10c5387d Table: 8f3b4019 DAC: 00000015
    [ 79.833801] Process gpsd (pid: 1265, stack limit = 0xcf2802e8)
    [ 79.839965] Stack: (0xcf281ee0 to 0xcf282000)
    [ 79.844573] 1ee0: 00000002 00000000 c0040a24 00000000 00000002 cf281f08 00200200 00000000
    [ 79.853210] 1f00: 00000000 cf281f18 cf281f08 00000000 00000000 00000000 cf281f18 cf281f18
    [ 79.861816] 1f20: 00000000 00000001 c056184c 00000000 00000001 b6f234d0 c0561848 00000004
    [ 79.870452] 1f40: cf280000 c003a3b8 c051e79c 00000001 00000000 00000100 3fa9e7b8 0000000a
    [ 79.879089] 1f60: 00000025 cf280000 00000025 00000000 00000000 b6f234d0 00000000 00000004
    [ 79.887756] 1f80: 00000000 c003a924 c053ad38 c0013a50 fa200000 cf281fb0 ffffffff c0008530
    [ 79.896362] 1fa0: 0001e6a0 0000aab8 80000010 c037499c 0001e6a0 be8dab00 0001e698 00036698
    [ 79.904998] 1fc0: 0002df98 0002df38 0000001f 00000000 b6f234d0 00000000 00000004 00000000
    [ 79.913665] 1fe0: 0001e6f8 be8d6aa0 be8dac50 0000aab8 80000010 ffffffff 00fbf700 04ffff00
    [ 79.922302] [] (run_timer_softirq+0x16c/0x3ac) from [] (__do_softirq+0xd4/0x22c)
    [ 79.931945] [] (__do_softirq+0xd4/0x22c) from [] (irq_exit+0x8c/0x94)
    [ 79.940582] [] (irq_exit+0x8c/0x94) from [] (handle_IRQ+0x34/0x84)
    [ 79.948913] [] (handle_IRQ+0x34/0x84) from [] (omap3_intc_handle_irq+0x48/0x4c)
    [ 79.958404] [] (omap3_intc_handle_irq+0x48/0x4c) from [] (__irq_usr+0x3c/0x60)
    [ 79.967773] Exception stack(0xcf281fb0 to 0xcf281ff8)
    [ 79.973083] 1fa0: 0001e6a0 be8dab00 0001e698 00036698
    [ 79.981658] 1fc0: 0002df98 0002df38 0000001f 00000000 b6f234d0 00000000 00000004 00000000
    [ 79.990234] 1fe0: 0001e6f8 be8d6aa0 be8dac50 0000aab8 80000010 ffffffff
    [ 79.997161] Code: bad PC value
    [ 80.000396] ---[ end trace 6f6739840475f9ee ]---
    [ 80.005279] Kernel panic - not syncing: Fatal exception in interrupt

    Signed-off-by: Johan Hovold
    Acked-by: Marcel Holtmann
    Signed-off-by: Johan Hedberg
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     

13 Apr, 2012

2 commits

  • commit 18daf1644e634bae951a6e3d4d19d89170209762 upstream

    Commit 330605423c fixed l2cap conn establishment for non-ssp remote
    devices by not setting HCI_CONN_ENCRYPT_PEND every time conn security
    is tested (which was always returning failure on any subsequent
    security checks).

    However, this broke l2cap conn establishment for ssp remote devices
    when an ACL link was already established at SDP-level security. This
    fix ensures that encryption must be pending whenever authentication
    is also pending.

    Signed-off-by: Peter Hurley
    Tested-by: Daniel Wagner
    Acked-by: Marcel Holtmann
    Signed-off-by: Johan Hedberg

    Peter Hurley
     
  • commit d72308bff5c2fa207949a5925b020bce74495e33 upstream.

    Is possible that we will arm the tid_rx->reorder_timer after
    del_timer_sync() in ___ieee80211_stop_rx_ba_session(). We need to stop
    timer after RCU grace period finish, so move it to
    ieee80211_free_tid_rx(). Timer will not be armed again, as
    rcu_dereference(sta->ampdu_mlme.tid_rx[tid]) will return NULL.

    Debug object detected problem with the following warning:
    ODEBUG: free active (active state 0) object type: timer_list hint: sta_rx_agg_reorder_timer_expired+0x0/0xf0 [mac80211]

    Bug report (with all warning messages):
    https://bugzilla.redhat.com/show_bug.cgi?id=804007

    Reported-by: "jan p. springer"
    Signed-off-by: Stanislaw Gruszka
    Signed-off-by: John W. Linville
    Signed-off-by: Greg Kroah-Hartman

    Stanislaw Gruszka