28 Jan, 2015

19 commits

  • commit 08f6f147773b23b765b94633a8eaa82e7defcf4c upstream.

    The VHT supported channel width field is a two bit integer, not a
    bitfield. cfg80211_chandef_usable() was interpreting it incorrectly and
    ended up rejecting 160 MHz channel width if the driver indicated support
    for both 160 and 80+80 MHz channels.

    Fixes: 3d9d1d6656a73 ("nl80211/cfg80211: support VHT channel configuration")
    (however, no real drivers had 160 MHz support it until 3.16)
    Signed-off-by: Jouni Malinen
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Jouni Malinen
     
  • commit 34f05f543f02350e920bddb7660ffdd4697aaf60 upstream.

    In the already-set and intersect case of a driver-hint, the previous
    wiphy regdomain was not freed before being reset with a copy of the
    cfg80211 regdomain.

    Signed-off-by: Arik Nemtsov
    Acked-by: Luis R. Rodriguez
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Arik Nemtsov
     
  • commit 70dcec5a488a7b81779190ac8089475fe4b8b962 upstream.

    This can happen and there is no point in added more
    detection code lower in the stack. Catching these in one
    single point (cfg80211) is enough. Stop WARNING about this
    case.

    This fixes:
    https://bugzilla.kernel.org/show_bug.cgi?id=89001

    Fixes: 2f1c6c572d7b ("cfg80211: process non country IE conflicting first")
    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Emmanuel Grumbach
     
  • commit f89f46cf3a23d8d7c98f924a461fd931e1331746 upstream.

    If the userspace passes a malformed sched scan request (or a net
    detect wowlan configuration) by adding a NL80211_ATTR_SCHED_SCAN_MATCH
    attribute without any nested matchsets, a NULL pointer dereference
    will occur. Fix this by checking that we do have matchsets in our
    array before trying to access it.

    BUG: unable to handle kernel NULL pointer dereference at 0000000000000024
    IP: [] nl80211_parse_sched_scan.part.67+0x6e9/0x900 [cfg80211]
    PGD 865c067 PUD 865b067 PMD 0
    Oops: 0002 [#1] SMP
    Modules linked in: iwlmvm(O) iwlwifi(O) mac80211(O) cfg80211(O) compat(O) [last unloaded: compat]
    CPU: 2 PID: 2442 Comm: iw Tainted: G O 3.17.2 #31
    Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
    task: ffff880013800790 ti: ffff880008d80000 task.ti: ffff880008d80000
    RIP: 0010:[] [] nl80211_parse_sched_scan.part.67+0x6e9/0x900 [cfg80211]
    RSP: 0018:ffff880008d838d0 EFLAGS: 00010293
    RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
    RDX: 000000000000143c RSI: 0000000000000000 RDI: ffff880008ee8dd0
    RBP: ffff880008d83948 R08: 0000000000000002 R09: 0000000000000019
    R10: ffff88001d1b3c40 R11: 0000000000000002 R12: ffff880019e85e00
    R13: 00000000fffffed4 R14: ffff880009757800 R15: 0000000000001388
    FS: 00007fa3b6d13700(0000) GS:ffff88003e200000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000024 CR3: 0000000008670000 CR4: 00000000000006e0
    Stack:
    ffff880009757800 ffff880000000001 0000000000000000 ffff880008ee84e0
    0000000000000000 ffff880009757800 00000000fffffed4 ffff880008d83948
    ffffffff814689c9 ffff880009757800 ffff880008ee8000 0000000000000000
    Call Trace:
    [] ? nla_parse+0xb9/0x120
    [] nl80211_set_wowlan+0x75e/0x960 [cfg80211]
    [] ? mark_held_locks+0x75/0xa0
    [] genl_family_rcv_msg+0x18b/0x360
    [] ? trace_hardirqs_on+0xd/0x10
    [] genl_rcv_msg+0x84/0xc0
    [] ? genl_family_rcv_msg+0x360/0x360
    [] netlink_rcv_skb+0xa9/0xd0
    [] genl_rcv+0x28/0x40
    [] netlink_unicast+0x105/0x180
    [] netlink_sendmsg+0x34f/0x7a0
    [] ? kvm_clock_read+0x27/0x40
    [] sock_sendmsg+0x8d/0xc0
    [] ? might_fault+0xb9/0xc0
    [] ? might_fault+0x5e/0xc0
    [] ? verify_iovec+0x56/0xe0
    [] ___sys_sendmsg+0x3d0/0x3e0
    [] ? sched_clock_cpu+0x98/0xd0
    [] ? __do_page_fault+0x254/0x580
    [] ? up_read+0x1f/0x40
    [] ? __do_page_fault+0x254/0x580
    [] ? __fget_light+0x13d/0x160
    [] __sys_sendmsg+0x42/0x80
    [] SyS_sendmsg+0x12/0x20
    [] system_call_fastpath+0x16/0x1b

    Fixes: ea73cbce4e1f ("nl80211: fix scheduled scan RSSI matchset attribute confusion")
    Signed-off-by: Luciano Coelho
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Luciano Coelho
     
  • [ Upstream commit 843925f33fcc293d80acf2c5c8a78adf3344d49b ]

    Thomas Jarosch reported IPsec TCP stalls when a PMTU event occurs.

    In fact the problem was completely unrelated to IPsec. The bug is
    also reproducible if you just disable TSO/GSO.

    The problem is that when the MSS goes down, existing queued packet
    on the TX queue that have not been transmitted yet all look like
    TSO packets and get treated as such.

    This then triggers a bug where tcp_mss_split_point tells us to
    generate a zero-sized packet on the TX queue. Once that happens
    we're screwed because the zero-sized packet can never be removed
    by ACKs.

    Fixes: 1485348d242 ("tcp: Apply device TSO segment limit earlier")
    Reported-by: Thomas Jarosch
    Signed-off-by: Herbert Xu

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

    Herbert Xu
     
  • [ Upstream commit 5f35227ea34bb616c436d9da47fc325866c428f3 ]

    GSO isn't the only offload feature with restrictions that
    potentially can't be expressed with the current features mechanism.
    Checksum is another although it's a general issue that could in
    theory apply to anything. Even if it may be possible to
    implement these restrictions in other ways, it can result in
    duplicate code or inefficient per-packet behavior.

    This generalizes ndo_gso_check so that drivers can remove any
    features that don't make sense for a given packet, similar to
    netif_skb_features(). It also converts existing driver
    restrictions to the new format, completing the work that was
    done to support tunnel protocols since the issues apply to
    checksums as well.

    By actually removing features from the set that are used to do
    offloading, it solves another problem with the existing
    interface. In these cases, GSO would run with the original set
    of features and not do anything because it appears that
    segmentation is not required.

    CC: Tom Herbert
    CC: Joe Stringer
    CC: Eric Dumazet
    CC: Hayes Wang
    Signed-off-by: Jesse Gross
    Acked-by: Tom Herbert
    Fixes: 04ffcb255f22 ("net: Add ndo_gso_check")
    Tested-by: Hayes Wang
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Jesse Gross
     
  • [ Upstream commit 2c26d34bbcc0b3f30385d5587aa232289e2eed8e ]

    When using VXLAN tunnels and a sky2 device, I have experienced
    checksum failures of the following type:

    [ 4297.761899] eth0: hw csum failure
    [...]
    [ 4297.765223] Call Trace:
    [ 4297.765224] [] dump_stack+0x46/0x58
    [ 4297.765235] [] netdev_rx_csum_fault+0x42/0x50
    [ 4297.765238] [] ? skb_push+0x40/0x40
    [ 4297.765240] [] __skb_checksum_complete+0xbc/0xd0
    [ 4297.765243] [] tcp_v4_rcv+0x2e2/0x950
    [ 4297.765246] [] ? ip_rcv_finish+0x360/0x360

    These are reliably reproduced in a network topology of:

    container:eth0 == host(OVS VXLAN on VLAN) == bond0 == eth0 (sky2) -> switch

    When VXLAN encapsulated traffic is received from a similarly
    configured peer, the above warning is generated in the receive
    processing of the encapsulated packet. Note that the warning is
    associated with the container eth0.

    The skbs from sky2 have ip_summed set to CHECKSUM_COMPLETE, and
    because the packet is an encapsulated Ethernet frame, the checksum
    generated by the hardware includes the inner protocol and Ethernet
    headers.

    The receive code is careful to update the skb->csum, except in
    __dev_forward_skb, as called by dev_forward_skb. __dev_forward_skb
    calls eth_type_trans, which in turn calls skb_pull_inline(skb, ETH_HLEN)
    to skip over the Ethernet header, but does not update skb->csum when
    doing so.

    This patch resolves the problem by adding a call to
    skb_postpull_rcsum to update the skb->csum after the call to
    eth_type_trans.

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

    Jay Vosburgh
     
  • [ Upstream commit b8fb4e0648a2ab3734140342002f68fb0c7d1602 ]

    skb_scrub_packet() is called when a packet switches between a context
    such as between underlay and overlay, between namespaces, or between
    L3 subnets.

    While we already scrub the packet mark, connection tracking entry,
    and cached destination, the security mark/context is left intact.

    It seems wrong to inherit the security context of a packet when going
    from overlay to underlay or across forwarding paths.

    Signed-off-by: Thomas Graf
    Acked-by: Flavio Leitner
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Thomas Graf
     
  • [ Upstream commit 796f2da81bead71ffc91ef70912cd8d1827bf756 ]

    When vlan tags are stacked, it is very likely that the outer tag is stored
    in skb->vlan_tci and skb->protocol shows the inner tag's vlan_proto.
    Currently netif_skb_features() first looks at skb->protocol even if there
    is the outer tag in vlan_tci, thus it incorrectly retrieves the protocol
    encapsulated by the inner vlan instead of the inner vlan protocol.
    This allows GSO packets to be passed to HW and they end up being
    corrupted.

    Fixes: 58e998c6d239 ("offloading: Force software GSO for multiple vlan tags.")
    Signed-off-by: Toshiaki Makita
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Toshiaki Makita
     
  • [ Upstream commit 2dc49d1680b534877fd20cce52557ea542bb06b6 ]

    When xfrm6_policy_check() is used, _decode_session6() is called after some
    intermediate functions. This function uses IP6CB(), thus TCP_SKB_CB() must be
    prepared after the call of xfrm6_policy_check().

    Before this patch, scenarii with IPv6 + TCP + IPsec Transport are broken.

    Fixes: 971f10eca186 ("tcp: better TCP_SKB_CB layout to reduce cache line misses")
    Reported-by: Huaibin Wang
    Suggested-by: Eric Dumazet
    Signed-off-by: Nicolas Dichtel
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Nicolas Dichtel
     
  • [ Upstream commit 0d1644919578db525b9a7b6c8197ce02adbfce26 ]

    Gateway having bandwidth_down equal to zero are not accepted
    at all and so never added to the Gateway list.
    For this reason checking the bandwidth_down member in
    batadv_gw_out_of_range() is useless.

    This is probably a copy/paste error and this check was supposed
    to be "!gw_node" only. Moreover, the way the check is written
    now may also lead to a NULL dereference.

    Fix this by rewriting the if-condition properly.

    Introduced by 414254e342a0d58144de40c3da777521ebaeeb07
    ("batman-adv: tvlv - gateway download/upload bandwidth container")

    Signed-off-by: Antonio Quartulli
    Reported-by: David Binderman
    Signed-off-by: Marek Lindner
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Antonio Quartulli
     
  • [ Upstream commit 0402e444cd199389b7fe47be68a67b817e09e097 ]

    The fragmentation code was replaced in 610bfc6bc99bc83680d190ebc69359a05fc7f605
    ("batman-adv: Receive fragmented packets and merge") by an implementation which
    can handle up to 16 fragments of a packet. The packet is prepared for the split
    in fragments by the function batadv_frag_send_packet and the actual split is
    done by batadv_frag_create.

    Both functions calculate the size of a fragment themself. But their calculation
    differs because batadv_frag_send_packet also subtracts ETH_HLEN. Therefore,
    the check in batadv_frag_send_packet "can a full fragment can be created?" may
    return true even when batadv_frag_create cannot create a full fragment.

    The function batadv_frag_create doesn't check the size of the skb before
    splitting it and therefore might try to create a larger fragment than the
    remaining buffer. This creates an integer underflow and an invalid len is given
    to skb_split.

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

    Sven Eckelmann
     
  • [ Upstream commit 5b6698b0e4a37053de35cc24ee695b98a7eb712b ]

    The fragmentation code was replaced in 610bfc6bc99bc83680d190ebc69359a05fc7f605
    ("batman-adv: Receive fragmented packets and merge"). The new code provided a
    mostly unused parameter skb for the merging function. It is used inside the
    function to calculate the additionally needed skb tailroom. But instead of
    increasing its own tailroom, it is only increasing the tailroom of the first
    queued skb. This is not correct in some situations because the first queued
    entry can be a different one than the parameter.

    An observed problem was:

    1. packet with size 104, total_size 1464, fragno 1 was received
    - packet is queued
    2. packet with size 1400, total_size 1464, fragno 0 was received
    - packet is queued at the end of the list
    3. enough data was received and can be given to the merge function
    (1464 == (1400 - 20) + (104 - 20))
    - merge functions gets 1400 byte large packet as skb argument
    4. merge function gets first entry in queue (104 byte)
    - stored as skb_out
    5. merge function calculates the required extra tail as total_size - skb->len
    - pskb_expand_head tail of skb_out with 64 bytes
    6. merge function tries to squeeze the extra 1380 bytes from the second queued
    skb (1400 byte aka skb parameter) in the 64 extra tail bytes of skb_out

    Instead calculate the extra required tail bytes for skb_out also using skb_out
    instead of using the parameter skb. The skb parameter is only used to get the
    total_size from the last received packet. This is also the total_size used to
    decide that all fragments were received.

    Reported-by: Philipp Psurek
    Signed-off-by: Sven Eckelmann
    Acked-by: Martin Hundebøll
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Sven Eckelmann
     
  • [ Upstream commit af6dabc9c70ae3f307685b1f32f52d60b1bf0527 ]

    Commit cecda693a969816bac5e470e1d9c9c0ef5567bca ("net: keep original skb
    which only needs header checking during software GSO") keeps the original
    skb for packets that only needs header check, but it doesn't drop the
    packet if software segmentation or header check were failed.

    Fixes cecda693a9 ("net: keep original skb which only needs header checking during software GSO")
    Cc: Eric Dumazet
    Signed-off-by: Jason Wang
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Jason Wang
     
  • [ Upstream commit 12069401d895ff84076a50189ca842c0696b84b2 ]

    Currently, searching for a socket to add a reference to is not
    synchronized with deletion of sockets. This can result in use
    after free if there is another operation that is removing a
    socket at the same time. Solving this requires both holding the
    appropriate lock and checking the refcount to ensure that it
    has not already hit zero.

    Inspired by a related (but not exactly the same) issue in the
    VXLAN driver.

    Fixes: 0b5e8b8e ("net: Add Geneve tunneling protocol driver")
    CC: Andy Zhou
    Signed-off-by: Jesse Gross
    Acked-by: Thomas Graf
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Jesse Gross
     
  • [ Upstream commit 7ed767f73192d6daf673c6d885cd02d5f280ac1f ]

    Sockets aren't currently removed from the the global list when
    they are destroyed. In addition, offload handlers need to be cleaned
    up as well.

    Fixes: 0b5e8b8e ("net: Add Geneve tunneling protocol driver")
    CC: Andy Zhou
    Signed-off-by: Jesse Gross
    Acked-by: Thomas Graf
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Jesse Gross
     
  • [ Upstream commit a18e6a186f53af06937a2c268c72443336f4ab56 ]

    Each mmap Netlink frame contains a status field which indicates
    whether the frame is unused, reserved, contains data or needs to
    be skipped. Both loads and stores may not be reordeded and must
    complete before the status field is changed and another CPU might
    pick up the frame for use. Use an smp_mb() to cover needs of both
    types of callers to netlink_set_status(), callers which have been
    reading data frame from the frame, and callers which have been
    filling or releasing and thus writing to the frame.

    - Example code path requiring a smp_rmb():
    memcpy(skb->data, (void *)hdr + NL_MMAP_HDRLEN, hdr->nm_len);
    netlink_set_status(hdr, NL_MMAP_STATUS_UNUSED);

    - Example code path requiring a smp_wmb():
    hdr->nm_uid = from_kuid(sk_user_ns(sk), NETLINK_CB(skb).creds.uid);
    hdr->nm_gid = from_kgid(sk_user_ns(sk), NETLINK_CB(skb).creds.gid);
    netlink_frame_flush_dcache(hdr);
    netlink_set_status(hdr, NL_MMAP_STATUS_VALID);

    Fixes: f9c228 ("netlink: implement memory mapped recvmsg()")
    Reported-by: Eric Dumazet
    Signed-off-by: Thomas Graf
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Thomas Graf
     
  • [ Upstream commit 4682a0358639b29cf69437ed909c6221f8c89847 ]

    Checking the file f_count and the nlk->mapped count is not completely
    sufficient to prevent the mmap'd area contents from changing from
    under us during netlink mmap sendmsg() operations.

    Be careful to sample the header's length field only once, because this
    could change from under us as well.

    Fixes: 5fd96123ee19 ("netlink: implement memory mapped sendmsg()")
    Signed-off-by: David S. Miller
    Acked-by: Daniel Borkmann
    Acked-by: Thomas Graf
    Signed-off-by: Greg Kroah-Hartman

    David Miller
     
  • [ Upstream commit 8a0033a947403569caeca45fa5e6f7ba60d51974 ]

    The NBMA GRE tunnels temporarily push GRE header that contain the
    per-packet NBMA destination on the skb via header ops early in xmit
    path. It is the later pulled before the real GRE header is constructed.

    The inner mac was thus set differently in nbma case: the GRE header
    has been pushed by neighbor layer, and mac header points to beginning
    of the temporary gre header (set by dev_queue_xmit).

    Now that the offloads expect mac header to point to the gre payload,
    fix the xmit patch to:
    - pull first the temporary gre header away
    - and reset mac header to point to gre payload

    This fixes tso to work again with nbma tunnels.

    Fixes: 14051f0452a2 ("gre: Use inner mac length when computing tunnel length")
    Signed-off-by: Timo Teräs
    Cc: Tom Herbert
    Cc: Alexander Duyck
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Timo Teräs
     

16 Jan, 2015

8 commits

  • commit 1e359a5de861a57aa04d92bb620f52a5c1d7f8b1 upstream.

    This reverts commit ca34e3b5c808385b175650605faa29e71e91991b.

    It turns out that the p54 and cw2100 drivers assume that there's
    tailroom even when they don't say they really need it. However,
    there's currently no way for them to explicitly say they do need
    it, so for now revert this.

    This fixes https://bugzilla.kernel.org/show_bug.cgi?id=90331.

    Fixes: ca34e3b5c808 ("mac80211: Fix accounting of the tailroom-needed counter")
    Reported-by: Christopher Chavez
    Bisected-by: Larry Finger
    Debugged-by: Christian Lamparter
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • commit 49a068f82a1d30eb585d7804b05948376be6cf9a upstream.

    A struct xdr_stream at a page boundary might point to the end of one
    page or the beginning of the next, but xdr_truncate_encode isn't
    prepared to handle the former.

    This can cause corruption of NFSv4 READDIR replies in the case that a
    readdir entry that would have exceeded the client's dircount/maxcount
    limit would have ended exactly on a 4k page boundary. You're more
    likely to hit this case on large directories.

    Other xdr_truncate_encode callers are probably also affected.

    Reported-by: Holger Hoffstätte
    Tested-by: Holger Hoffstätte
    Fixes: 3e19ce762b53 "rpc: xdr_truncate_encode"
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    J. Bruce Fields
     
  • commit 6a8fc95c87110a466ee81675b41170b963f82bdb upstream.

    When connectable mode is enabled (page scan on) through some non-mgmt
    method the HCI_CONNECTABLE flag will not be set. For backwards
    compatibility with user space versions not using mgmt we should not
    require HCI_CONNECTABLE to be set if HCI_MGMT is not set.

    Reported-by: Pali Rohár
    Tested-by: Pali Rohár
    Signed-off-by: Johan Hedberg
    Signed-off-by: Marcel Holtmann
    Signed-off-by: Greg Kroah-Hartman

    Johan Hedberg
     
  • commit 8bfe8442ff20fdc2d965c197103d935a99bd3296 upstream.

    When controllers set the HCI_QUIRK_INVALID_BDADDR flag, it is required
    by userspace to program a valid public Bluetooth device address into
    the controller before it can be used.

    After successful address configuration, the internal state changes and
    the controller runs the complete initialization procedure. However one
    small difference is that this is no longer the HCI_SETUP stage. The
    HCI_SETUP stage is only valid during initial controller setup. In this
    case the stack runs the initialization as part of the HCI_CONFIG stage.

    The controller version information, default name and supported commands
    are only stored during HCI_SETUP. While these information are static,
    they are not read initially when HCI_QUIRK_INVALID_BDADDR is set. So
    when running in HCI_CONFIG state, these information need to be updated
    as well.

    This especially impacts Bluetooth 4.1 and later controllers using
    extended feature pages and second event mask page.

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

    Marcel Holtmann
     
  • commit a4d5504d5c39cc84f1f828e19967595597a8136e upstream.

    The internal representation of the LE white list needs to be cleared
    when receiving a successful HCI_Reset command. A reset of the controller
    is expected to start with an empty LE white list.

    When the LE white list is not cleared on controller reset, the passive
    background scanning might skip programming the remote devices. Only
    changes to the LE white list are programmed when passive background
    is started.

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

    Marcel Holtmann
     
  • commit 0b1db38ca26b322296cbd141f3080eccfe1cc3e1 upstream.

    These days we allow simultaneous LE scanning and advertising. Checking
    for whether advertising is enabled or not is therefore not a reliable
    way to determine whether directed advertising was used to trigger the
    connection creation. The appropriate place to check (instead of the hdev
    context) is the connection role that's stored in the hci_conn. This
    patch fixes such a check in le_conn_timeout() which could otherwise lead
    to incorrect HCI commands being sent.

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

    Johan Hedberg
     
  • commit 980ffc0a2cec2c37589cc97993e1ad17252f4f47 upstream.

    The le_conn_timeout() may call hci_le_conn_failed() which in turn may
    call hci_conn_del(). Trying to use the _sync variant for cancelling the
    conn timeout from hci_conn_del() could therefore result in a deadlock.
    This patch converts hci_conn_del() to use the non-sync variant so the
    deadlock is not possible.

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

    Johan Hedberg
     
  • commit b0c42cd7b210efc74aa4bfc3e39a2814dfaa9b89 upstream.

    This patch reverts commit:

    a7807d73 ("Bluetooth: 6lowpan: Avoid memory leak if memory allocation
    fails")

    which was wrong suggested by Alexander Aring. The function skb_unshare
    run also kfree_skb on failure.

    Signed-off-by: Alexander Aring
    Signed-off-by: Marcel Holtmann
    Signed-off-by: Greg Kroah-Hartman

    Alexander Aring
     

09 Jan, 2015

4 commits

  • commit 28a9bc68124c319b2b3dc861e80828a8865fd1ba upstream.

    When writing the code to allow per-station GTKs, I neglected to
    take into account the management frame keys (index 4 and 5) when
    freeing the station and only added code to free the first four
    data frame keys.

    Fix this by iterating the array of keys over the right length.

    Fixes: e31b82136d1a ("cfg80211/mac80211: allow per-station GTKs")
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • commit d025933e29872cb1fe19fc54d80e4dfa4ee5779c upstream.

    As multicast-frames can't be fragmented, "dot11MulticastReceivedFrameCount"
    stopped being incremented after the use-after-free fix. Furthermore, the
    RX-LED will be triggered by every multicast frame (which wouldn't happen
    before) which wouldn't allow the LED to rest at all.

    Fixes https://bugzilla.kernel.org/show_bug.cgi?id=89431 which also had the
    patch.

    Fixes: b8fff407a180 ("mac80211: fix use-after-free in defragmentation")
    Signed-off-by: Andreas Müller
    [rewrite commit message]
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Andreas Müller
     
  • commit 7e6225a1604d0c6aa4140289bf5761868ffc9c83 upstream.

    Avoid a case where we would access uninitialized stack data if the AP
    advertises HT support without 40MHz channel support.

    Fixes: f3000e1b43f1 ("mac80211: fix broken use of VHT/20Mhz with some APs")
    Signed-off-by: Jes Sorensen
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Jes Sorensen
     
  • commit 2967e031d4d737d9cc8252d878a17924d7b704f0 upstream.

    Instead of keeping track of all those special cases where
    VLAN interfaces have no bss_conf.chandef, just make sure
    they have the same as the AP interface they belong to.

    Among others, this fixes a crash getting a VLAN's channel
    from userspace since a NULL channel is returned as a good
    result (return value 0) for VLANs since the commit below.

    Fixes: c12bc4885f4b3 ("mac80211: return the vif's chandef in ieee80211_cfg_get_channel()")
    Signed-off-by: Felix Fietkau
    [rewrite commit log]
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Felix Fietkau
     

17 Dec, 2014

6 commits

  • [ Upstream commit 7f19fc5e0b617593dcda0d9956adc78b559ef1f5 ]

    For netlink, we shouldn't be using arch_fast_hash() as a hashing
    discipline, but rather jhash() instead.

    Since netlink sockets can be opened by any user, a local attacker
    would be able to easily create collisions with the DPDK-derived
    arch_fast_hash(), which trades off performance for security by
    using crc32 CPU instructions on x86_64.

    While it might have a legimite use case in other places, it should
    be avoided in netlink context, though. As rhashtable's API is very
    flexible, we could later on still decide on other hashing disciplines,
    if legitimate.

    Reference: http://thread.gmane.org/gmane.linux.kernel/1844123
    Fixes: e341694e3eb5 ("netlink: Convert netlink_lookup() to use RCU protected hash table")
    Cc: Herbert Xu
    Signed-off-by: Daniel Borkmann
    Acked-by: Thomas Graf
    Acked-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Daniel Borkmann
     
  • [ Upstream commit 69204cf7eb9c5a72067ce6922d4699378251d053 ]

    commit 46e5da40ae (net: qdisc: use rcu prefix and silence
    sparse warnings) triggers a spurious warning:

    net/sched/sch_fq_codel.c:97 suspicious rcu_dereference_check() usage!

    The code should be using the _bh variant of rcu_dereference.

    Signed-off-by: Valdis Kletnieks
    Acked-by: Eric Dumazet
    Acked-by: John Fastabend
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Valdis.Kletnieks@vt.edu
     
  • [ Upstream commit 0f85feae6b710ced3abad5b2b47d31dfcb956b62 ]

    When I cooked commit c3658e8d0f1 ("tcp: fix possible NULL dereference in
    tcp_vX_send_reset()") I missed other spots we could deref a NULL
    skb_dst(skb)

    Again, if a socket is provided, we do not need skb_dst() to get a
    pointer to network namespace : sock_net(sk) is good enough.

    Reported-by: Dann Frazier
    Bisected-by: Dann Frazier
    Tested-by: Dann Frazier
    Signed-off-by: Eric Dumazet
    Fixes: ca777eff51f7 ("tcp: remove dst refcount false sharing for prequeue mode")
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • [ Upstream commit 9772b54c55266ce80c639a80aa68eeb908f8ecf5 ]

    To accomodate for enough headroom for tunnels, use MAX_HEADER instead
    of LL_MAX_HEADER. Robert reported that he has hit after roughly 40hrs
    of trinity an skb_under_panic() via SCTP output path (see reference).
    I couldn't reproduce it from here, but not using MAX_HEADER as elsewhere
    in other protocols might be one possible cause for this.

    In any case, it looks like accounting on chunks themself seems to look
    good as the skb already passed the SCTP output path and did not hit
    any skb_over_panic(). Given tunneling was enabled in his .config, the
    headroom would have been expanded by MAX_HEADER in this case.

    Reported-by: Robert Święcki
    Reference: https://lkml.org/lkml/2014/12/1/507
    Fixes: 594ccc14dfe4d ("[SCTP] Replace incorrect use of dev_alloc_skb with alloc_skb in sctp_packet_transmit().")
    Signed-off-by: Daniel Borkmann
    Acked-by: Vlad Yasevich
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Daniel Borkmann
     
  • [ Upstream commit f2a01517f2a1040a0b156f171a7cefd748f2fd03 ]

    Following patch fixes typo in the flow validation. This prevented
    installation of ARP and IPv6 flows.

    Fixes: 19e7a3df72 ("openvswitch: Fix NDP flow mask validation")
    Signed-off-by: Pravin B Shelar
    Reviewed-by: Thomas Graf
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Pravin B Shelar
     
  • [ Upstream commit 6fb2a756739aa507c1fd5b8126f0bfc2f070dc46 ]

    Set the inner mac header to point to the GRE payload when
    doing GRO. This is needed if we proceed to send the packet
    through GRE GSO which now uses the inner mac header instead
    of inner network header to determine the length of encapsulation
    headers.

    Fixes: 14051f0452a2 ("gre: Use inner mac length when computing tunnel length")
    Reported-by: Wolfgang Walter
    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Tom Herbert
     

30 Nov, 2014

1 commit

  • rtnl_link_get_net() holds a reference on the 'struct net', we need to release
    it in case of error.

    CC: Eric W. Biederman
    Fixes: b51642f6d77b ("net: Enable a userns root rtnl calls that are safe for unprivilged users")
    Signed-off-by: Nicolas Dichtel
    Reviewed-by: "Eric W. Biederman"
    Signed-off-by: David S. Miller

    Nicolas Dichtel
     

28 Nov, 2014

1 commit

  • Pull networking fixes from David Miller:
    "Several small fixes here:

    1) Don't crash in tg3 driver when the number of tx queues has been
    configured to be different from the number of rx queues. From
    Thadeu Lima de Souza Cascardo.

    2) VLAN filter not disabled properly in promisc mode in ixgbe driver,
    from Vlad Yasevich.

    3) Fix OOPS on dellink op in VTI tunnel driver, from Xin Long.

    4) IPV6 GRE driver WCCP code checks skb->protocol for ETH_P_IP
    instead of ETH_P_IPV6, whoops. From Yuri Chislov.

    5) Socket matching in ping driver is buggy when packet AF does not
    match socket's AF. Fix from Jane Zhou.

    6) Fix checksum calculation errors in VXLAN due to where the
    udp_tunnel6_xmit_skb() helper gets it's saddr/daddr from. From
    Alexander Duyck.

    7) Fix 5G detection problem in rtlwifi driver, from Larry Finger.

    8) Fix NULL deref in tcp_v{4,6}_send_reset, from Eric Dumazet.

    9) Various missing netlink attribute verifications in bridging code,
    from Thomas Graf.

    10) tcp_recvmsg() unconditionally calls ipv4 ip_recv_error even for
    ipv6 sockets, whoops. Fix from Willem de Bruijn"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (29 commits)
    net-timestamp: make tcp_recvmsg call ipv6_recv_error for AF_INET6 socks
    bridge: Sanitize IFLA_EXT_MASK for AF_BRIDGE:RTM_GETLINK
    bridge: Add missing policy entry for IFLA_BRPORT_FAST_LEAVE
    net: Check for presence of IFLA_AF_SPEC
    net: Validate IFLA_BRIDGE_MODE attribute length
    bridge: Validate IFLA_BRIDGE_FLAGS attribute length
    stmmac: platform: fix default values of the filter bins setting
    net/mlx4_core: Limit count field to 24 bits in qp_alloc_res
    net: dsa: bcm_sf2: reset switch prior to initialization
    net: dsa: bcm_sf2: fix unmapping registers in case of errors
    tg3: fix ring init when there are more TX than RX channels
    tcp: fix possible NULL dereference in tcp_vX_send_reset()
    rtlwifi: Change order in device startup
    rtlwifi: rtl8821ae: Fix 5G detection problem
    Revert "netfilter: conntrack: fix race in __nf_conntrack_confirm against get_next_corpse"
    vxlan: Fix boolean flip in VXLAN_F_UDP_ZERO_CSUM6_[TX|RX]
    ip6_udp_tunnel: Fix checksum calculation
    net-timestamp: Fix a documentation typo
    net/ping: handle protocol mismatching scenario
    af_packet: fix sparse warning
    ...

    Linus Torvalds
     

27 Nov, 2014

1 commit

  • TCP timestamping introduced MSG_ERRQUEUE handling for TCP sockets.
    If the socket is of family AF_INET6, call ipv6_recv_error instead
    of ip_recv_error.

    This change is more complex than a single branch due to the loadable
    ipv6 module. It reuses a pre-existing indirect function call from
    ping. The ping code is safe to call, because it is part of the core
    ipv6 module and always present when AF_INET6 sockets are active.

    Fixes: 4ed2d765 (net-timestamp: TCP timestamping)
    Signed-off-by: Willem de Bruijn

    ----

    It may also be worthwhile to add WARN_ON_ONCE(sk->family == AF_INET6)
    to ip_recv_error.
    Signed-off-by: David S. Miller

    Willem de Bruijn