13 Dec, 2018

1 commit

  • The commit ae97fd867aa3 ("MLK-19091 cfg80211: make phy index match
    after wiphy dev is released") manage wiphy_counter matching between
    creating and freeing wiphy device. Then for one wifi instance, the index
    of attached phy is not changed during loadable test. But it ignores
    multiple wifi cards loadable test case, that introduces the phy index
    confliction. So the patch revert the commit.

    Reviewed-by: Richard Zhu
    Signed-off-by: Fugang Duan
    (cherry picked from commit: 0977a2d9c95ba8a79dbedc995931a1f459fb2438)

    Andy Duan
     

29 Oct, 2018

2 commits

  • During insmod/rmmod test, the phy index increases that cause troube
    for test case. To make global variable wiphy_counter match between
    creat and free wiphy device, it needs to decrease the atomic counter
    when wiphy device is freed.

    Reviewed-by: Richard Zhu
    Signed-off-by: Fugang Duan

    Andy Duan
     
  • [Patch] Pulling the following commits and some general changes
    from custom v3.10 kernel for supporting qcacld2.0 on kernel v4.9.11.
    1. cfg80211: Using new wiphy flag WIPHY_FLAG_DFS_OFFLOAD
    When flag WIPHY_FLAG_DFS_OFFLOAD is defined, the driver would handle
    all the DFS related operations. Therefore the kernel needs to ignore
    the DFS state that it uses to block the userspace calls to the driver
    through cfg80211 APIs. Also it should treat the userspace calls to
    start radar detection as a no-op.

    Please note that changes in util.c is not picked up explicitly.
    Kernel v4.9.11 uses wrapper cfg80211_get_chans_dfs_required which takes
    care of this change.

    Change-Id: I9dd2076945581ca67e54dfc96dd3dbc526c6f0a2
    IRs-Fixed: 202686

    2. New db.txt from git/sforshee/wireless-regdb.git
    CONFIG_CFG80211_INTERNAL_REGDB is enabled in build. This causes
    kernel warn messages as db.txt is empty. A new db.txt is added
    from:
    git://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git

    IRs-Fixed: 202686

    3. Picked up the declaration and definition of the function
    cfg80211_is_gratuitous_arp_unsolicited_na

    Change-Id: I1e4083a2327c121073226aa6b75bb6b5b97cec00
    CRs-fixed: 1079453

    Signed-off-by: Nakul Kachhwaha
    Signed-off-by: Fugang Duan

    Nakul Kachhwaha
     

20 Oct, 2018

10 commits

  • [ Upstream commit 4c4af6900844ab04c9434c972021d7b48610e06a ]

    The hardif_neigh refcounter is to be decreased by the queued work and
    currently is never decreased if the queue_work() call fails.
    Fix by checking the queue_work() return value and decrease refcount
    if necessary.

    Signed-off-by: Marek Lindner
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Marek Lindner
     
  • [ Upstream commit 5af96b9c59c72fb2af2d19c5cc2f3cdcee391dff ]

    The backbone_gw refcounter is to be decreased by the queued work and
    currently is never decreased if the queue_work() call fails.
    Fix by checking the queue_work() return value and decrease refcount
    if necessary.

    Signed-off-by: Marek Lindner
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Marek Lindner
     
  • [ Upstream commit ae3cdc97dc10c7a3b31f297dab429bfb774c9ccb ]

    The function batadv_tvlv_handler_register is responsible for adding new
    tvlv_handler to the handler_list. It first checks whether the entry
    already is in the list or not. If it is, then the creation of a new entry
    is aborted.

    But the lock for the list is only held when the list is really modified.
    This could lead to duplicated entries because another context could create
    an entry with the same key between the check and the list manipulation.

    The check and the manipulation of the list must therefore be in the same
    locked code section.

    Fixes: ef26157747d4 ("batman-adv: tvlv - basic infrastructure")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sven Eckelmann
     
  • [ Upstream commit e7136e48ffdfb9f37b0820f619380485eb407361 ]

    The function batadv_tt_global_orig_entry_add is responsible for adding new
    tt_orig_list_entry to the orig_list. It first checks whether the entry
    already is in the list or not. If it is, then the creation of a new entry
    is aborted.

    But the lock for the list is only held when the list is really modified.
    This could lead to duplicated entries because another context could create
    an entry with the same key between the check and the list manipulation.

    The check and the manipulation of the list must therefore be in the same
    locked code section.

    Fixes: d657e621a0f5 ("batman-adv: add reference counting for type batadv_tt_orig_list_entry")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sven Eckelmann
     
  • [ Upstream commit 94cb82f594ed86be303398d6dfc7640a6f1d45d4 ]

    The function batadv_softif_vlan_get is responsible for adding new
    softif_vlan to the softif_vlan_list. It first checks whether the entry
    already is in the list or not. If it is, then the creation of a new entry
    is aborted.

    But the lock for the list is only held when the list is really modified.
    This could lead to duplicated entries because another context could create
    an entry with the same key between the check and the list manipulation.

    The check and the manipulation of the list must therefore be in the same
    locked code section.

    Fixes: 5d2c05b21337 ("batman-adv: add per VLAN interface attribute framework")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sven Eckelmann
     
  • [ Upstream commit fa122fec8640eb7186ce5a41b83a4c1744ceef8f ]

    The function batadv_nc_get_nc_node is responsible for adding new nc_nodes
    to the in_coding_list and out_coding_list. It first checks whether the
    entry already is in the list or not. If it is, then the creation of a new
    entry is aborted.

    But the lock for the list is only held when the list is really modified.
    This could lead to duplicated entries because another context could create
    an entry with the same key between the check and the list manipulation.

    The check and the manipulation of the list must therefore be in the same
    locked code section.

    Fixes: d56b1705e28c ("batman-adv: network coding - detect coding nodes and remove these after timeout")
    Signed-off-by: Sven Eckelmann
    Acked-by: Marek Lindner
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sven Eckelmann
     
  • [ Upstream commit dff9bc42ab0b2d38c5e90ddd79b238fed5b4c7ad ]

    The function batadv_gw_node_add is responsible for adding new gw_node to
    the gateway_list. It is expecting that the caller already checked that
    there is not already an entry with the same key or not.

    But the lock for the list is only held when the list is really modified.
    This could lead to duplicated entries because another context could create
    an entry with the same key between the check and the list manipulation.

    The check and the manipulation of the list must therefore be in the same
    locked code section.

    Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
    Signed-off-by: Sven Eckelmann
    Acked-by: Marek Lindner
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sven Eckelmann
     
  • [ Upstream commit a25bab9d723a08bd0bdafb1529faf9094c690b70 ]

    The per hardif sysfs file "batman_adv/elp_interval" is using the generic
    functions to store/show uint values. The helper __batadv_store_uint_attr
    requires the softif net_device as parameter to print the resulting change
    as info text when the users writes to this file. It uses the helper
    function batadv_info to add it at the same time to the kernel ring buffer
    and to the batman-adv debug log (when CONFIG_BATMAN_ADV_DEBUG is enabled).

    The function batadv_info requires as first parameter the batman-adv softif
    net_device. This parameter is then used to find the private buffer which
    contains the debug log for this batman-adv interface. But
    batadv_store_throughput_override used as first argument the slave
    net_device. This slave device doesn't have the batadv_priv private data
    which is access by batadv_info.

    Writing to this file with CONFIG_BATMAN_ADV_DEBUG enabled can either lead
    to a segfault or to memory corruption.

    Fixes: 0744ff8fa8fa ("batman-adv: Add hard_iface specific sysfs wrapper macros for UINT")
    Signed-off-by: Sven Eckelmann
    Acked-by: Marek Lindner
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sven Eckelmann
     
  • [ Upstream commit b9fd14c20871e6189f635e49b32d7789e430b3c8 ]

    The per hardif sysfs file "batman_adv/throughput_override" prints the
    resulting change as info text when the users writes to this file. It uses
    the helper function batadv_info to add it at the same time to the kernel
    ring buffer and to the batman-adv debug log (when CONFIG_BATMAN_ADV_DEBUG
    is enabled).

    The function batadv_info requires as first parameter the batman-adv softif
    net_device. This parameter is then used to find the private buffer which
    contains the debug log for this batman-adv interface. But
    batadv_store_throughput_override used as first argument the slave
    net_device. This slave device doesn't have the batadv_priv private data
    which is access by batadv_info.

    Writing to this file with CONFIG_BATMAN_ADV_DEBUG enabled can either lead
    to a segfault or to memory corruption.

    Fixes: 0b5ecc6811bd ("batman-adv: add throughput override attribute to hard_ifaces")
    Signed-off-by: Sven Eckelmann
    Acked-by: Marek Lindner
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sven Eckelmann
     
  • [ Upstream commit 88d0895d0ea9d4431507d576c963f2ff9918144d ]

    The probe ELPs for WiFi interfaces are expanded to contain at least
    BATADV_ELP_MIN_PROBE_SIZE bytes. This is usually a lot more than the
    number of bytes which the template ELP packet requires.

    These extra padding bytes were not initialized and thus could contain data
    which were previously stored at the same location. It is therefore required
    to set it to some predefined or random values to avoid leaking private
    information from the system transmitting these kind of packets.

    Fixes: e4623c913508 ("batman-adv: Avoid probe ELP information leak")
    Signed-off-by: Sven Eckelmann
    Acked-by: Antonio Quartulli
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sven Eckelmann
     

18 Oct, 2018

17 commits

  • [ Upstream commit 2ab2ddd301a22ca3c5f0b743593e4ad2953dfa53 ]

    Timer handlers do not imply rcu_read_lock(), so my recent fix
    triggered a LOCKDEP warning when SYNACK is retransmit.

    Lets add rcu_read_lock()/rcu_read_unlock() pairs around ireq->ireq_opt
    usages instead of guessing what is done by callers, since it is
    not worth the pain.

    Get rid of ireq_opt_deref() helper since it hides the logic
    without real benefit, since it is now a standard rcu_dereference().

    Fixes: 1ad98e9d1bdf ("tcp/dccp: fix lockdep issue when SYN is backlogged")
    Signed-off-by: Eric Dumazet
    Reported-by: Willem de Bruijn
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • [ Upstream commit 1ad98e9d1bdf4724c0a8532fabd84bf3c457c2bc ]

    In normal SYN processing, packets are handled without listener
    lock and in RCU protected ingress path.

    But syzkaller is known to be able to trick us and SYN
    packets might be processed in process context, after being
    queued into socket backlog.

    In commit 06f877d613be ("tcp/dccp: fix other lockdep splats
    accessing ireq_opt") I made a very stupid fix, that happened
    to work mostly because of the regular path being RCU protected.

    Really the thing protecting ireq->ireq_opt is RCU read lock,
    and the pseudo request refcnt is not relevant.

    This patch extends what I did in commit 449809a66c1d ("tcp/dccp:
    block BH for SYN processing") by adding an extra rcu_read_{lock|unlock}
    pair in the paths that might be taken when processing SYN from
    socket backlog (thus possibly in process context)

    Fixes: 06f877d613be ("tcp/dccp: fix other lockdep splats accessing ireq_opt")
    Signed-off-by: Eric Dumazet
    Reported-by: syzbot
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • [ Upstream commit 474ff2600889e16280dbc6ada8bfecb216169a70 ]

    So it should not fail with EPERM even though it is no longer implemented...

    This is a fix for:
    (userns)$ egrep ^Cap /proc/self/status
    CapInh: 0000003fffffffff
    CapPrm: 0000003fffffffff
    CapEff: 0000003fffffffff
    CapBnd: 0000003fffffffff
    CapAmb: 0000003fffffffff

    (userns)$ tcpdump -i usb_rndis0
    tcpdump: WARNING: usb_rndis0: SIOCETHTOOL(ETHTOOL_GUFO) ioctl failed: Operation not permitted
    Warning: Kernel filter failed: Bad file descriptor
    tcpdump: can't remove kernel filter: Bad file descriptor

    With this change it returns EOPNOTSUPP instead of EPERM.

    See also https://github.com/the-tcpdump-group/libpcap/issues/689

    Fixes: 08a00fea6de2 "net: Remove references to NETIF_F_UFO from ethtool."
    Cc: David S. Miller
    Signed-off-by: Maciej Żenczykowski
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Maciej Żenczykowski
     
  • [ Upstream commit 9d2f67e43b73e8af7438be219b66a5de0cfa8bd9 ]

    When we use raw socket as the vhost backend, a packet from virito with
    gso offloading information, cannot be sent out in later validaton at
    xmit path, as we did not set correct skb->protocol which is further used
    for looking up the gso function.

    To fix this, we set this field according to virito hdr information.

    Fixes: e858fae2b0b8f4 ("virtio_net: use common code for virtio_net_hdr and skb GSO conversion")
    Signed-off-by: Jianfeng Tan
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Jianfeng Tan
     
  • [ Upstream commit 7e823644b60555f70f241274b8d0120dd919269a ]

    Commit 2276f58ac589 ("udp: use a separate rx queue for packet reception")
    turned static inline __skb_recv_udp() from being a trivial helper around
    __skb_recv_datagram() into a UDP specific implementaion, making it
    EXPORT_SYMBOL_GPL() at the same time.

    There are external modules that got broken by __skb_recv_udp() not being
    visible to them. Let's unbreak them by making __skb_recv_udp EXPORT_SYMBOL().

    Rationale (one of those) why this is actually "technically correct" thing
    to do: __skb_recv_udp() used to be an inline wrapper around
    __skb_recv_datagram(), which itself (still, and correctly so, I believe)
    is EXPORT_SYMBOL().

    Cc: Paolo Abeni
    Cc: Eric Dumazet
    Fixes: 2276f58ac589 ("udp: use a separate rx queue for packet reception")
    Signed-off-by: Jiri Kosina
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Jiri Kosina
     
  • [ Upstream commit 92ef12b32feab8f277b69e9fb89ede2796777f4d ]

    In the case of implicit connect message with data > 1K, the flow
    control accounting is incorrect. At this state, the socket does not
    know the peer nodes capability and falls back to legacy flow control
    by return 1, however the receiver of this message will perform the
    new block accounting. This leads to a slack and eventually traffic
    disturbance.

    In this commit, we perform tipc_node_get_capabilities() at implicit
    connect and perform accounting based on the peer's capability.

    Signed-off-by: Parthasarathy Bhuvaragan
    Signed-off-by: Jon Maloy
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Parthasarathy Bhuvaragan
     
  • [ Upstream commit d7ab5cdce54da631f0c8c11e506c974536a3581e ]

    When processing pmtu update from an icmp packet, it calls .update_pmtu
    with sk instead of skb in sctp_transport_update_pmtu.

    However for sctp, the daddr in the transport might be different from
    inet_sock->inet_daddr or sk->sk_v6_daddr, which is used to update or
    create the route cache. The incorrect daddr will cause a different
    route cache created for the path.

    So before calling .update_pmtu, inet_sock->inet_daddr/sk->sk_v6_daddr
    should be updated with the daddr in the transport, and update it back
    after it's done.

    The issue has existed since route exceptions introduction.

    Fixes: 4895c771c7f0 ("ipv4: Add FIB nexthop exceptions.")
    Reported-by: ian.periam@dialogic.com
    Signed-off-by: Xin Long
    Acked-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Xin Long
     
  • [ Upstream commit 0e1d6eca5113858ed2caea61a5adc03c595f6096 ]

    We have an impressive number of syzkaller bugs that are linked
    to the fact that syzbot was able to create a networking device
    with millions of TX (or RX) queues.

    Let's limit the number of RX/TX queues to 4096, this really should
    cover all known cases.

    A separate patch will add various cond_resched() in the loops
    handling sysfs entries at device creation and dismantle.

    Tested:

    lpaa6:~# ip link add gre-4097 numtxqueues 4097 numrxqueues 4097 type ip6gretap
    RTNETLINK answers: Invalid argument

    lpaa6:~# time ip link add gre-4096 numtxqueues 4096 numrxqueues 4096 type ip6gretap

    real 0m0.180s
    user 0m0.000s
    sys 0m0.107s

    Fixes: 76ff5cc91935 ("rtnl: allow to specify number of rx and tx queues on device creation")
    Signed-off-by: Eric Dumazet
    Reported-by: syzbot
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • [ Upstream commit bd961c9bc66497f0c63f4ba1d02900bb85078366 ]

    Currently, rtnl_fdb_dump() assumes the family header is 'struct ifinfomsg',
    which is not always true -- 'struct ndmsg' is used by iproute2 ('ip neigh').

    The problem is, the function bails out early if nlmsg_parse() fails, which
    does occur for iproute2 usage of 'struct ndmsg' because the payload length
    is shorter than the family header alone (as 'struct ifinfomsg' is assumed).

    This breaks backward compatibility with userspace -- nothing is sent back.

    Some examples with iproute2 and netlink library for go [1]:

    1) $ bridge fdb show
    33:33:00:00:00:01 dev ens3 self permanent
    01:00:5e:00:00:01 dev ens3 self permanent
    33:33:ff:15:98:30 dev ens3 self permanent

    This one works, as it uses 'struct ifinfomsg'.

    fdb_show() @ iproute2/bridge/fdb.c
    """
    .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)),
    ...
    if (rtnl_dump_request(&rth, RTM_GETNEIGH, [...]
    """

    2) $ ip --family bridge neigh
    RTNETLINK answers: Invalid argument
    Dump terminated

    This one fails, as it uses 'struct ndmsg'.

    do_show_or_flush() @ iproute2/ip/ipneigh.c
    """
    .n.nlmsg_type = RTM_GETNEIGH,
    .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)),
    """

    3) $ ./neighlist
    < no output >

    This one fails, as it uses 'struct ndmsg'-based.

    neighList() @ netlink/neigh_linux.go
    """
    req := h.newNetlinkRequest(unix.RTM_GETNEIGH, [...]
    msg := Ndmsg{
    """

    The actual breakage was introduced by commit 0ff50e83b512 ("net: rtnetlink:
    bail out from rtnl_fdb_dump() on parse error"), because nlmsg_parse() fails
    if the payload length (with the _actual_ family header) is less than the
    family header length alone (which is assumed, in parameter 'hdrlen').
    This is true in the examples above with struct ndmsg, with size and payload
    length shorter than struct ifinfomsg.

    However, that commit just intends to fix something under the assumption the
    family header is indeed an 'struct ifinfomsg' - by preventing access to the
    payload as such (via 'ifm' pointer) if the payload length is not sufficient
    to actually contain it.

    The assumption was introduced by commit 5e6d24358799 ("bridge: netlink dump
    interface at par with brctl"), to support iproute2's 'bridge fdb' command
    (not 'ip neigh') which indeed uses 'struct ifinfomsg', thus is not broken.

    So, in order to unbreak the 'struct ndmsg' family headers and still allow
    'struct ifinfomsg' to continue to work, check for the known message sizes
    used with 'struct ndmsg' in iproute2 (with zero or one attribute which is
    not used in this function anyway) then do not parse the data as ifinfomsg.

    Same examples with this patch applied (or revert/before the original fix):

    $ bridge fdb show
    33:33:00:00:00:01 dev ens3 self permanent
    01:00:5e:00:00:01 dev ens3 self permanent
    33:33:ff:15:98:30 dev ens3 self permanent

    $ ip --family bridge neigh
    dev ens3 lladdr 33:33:00:00:00:01 PERMANENT
    dev ens3 lladdr 01:00:5e:00:00:01 PERMANENT
    dev ens3 lladdr 33:33:ff:15:98:30 PERMANENT

    $ ./neighlist
    netlink.Neigh{LinkIndex:2, Family:7, State:128, Type:0, Flags:2, IP:net.IP(nil), HardwareAddr:net.HardwareAddr{0x33, 0x33, 0x0, 0x0, 0x0, 0x1}, LLIPAddr:net.IP(nil), Vlan:0, VNI:0}
    netlink.Neigh{LinkIndex:2, Family:7, State:128, Type:0, Flags:2, IP:net.IP(nil), HardwareAddr:net.HardwareAddr{0x1, 0x0, 0x5e, 0x0, 0x0, 0x1}, LLIPAddr:net.IP(nil), Vlan:0, VNI:0}
    netlink.Neigh{LinkIndex:2, Family:7, State:128, Type:0, Flags:2, IP:net.IP(nil), HardwareAddr:net.HardwareAddr{0x33, 0x33, 0xff, 0x15, 0x98, 0x30}, LLIPAddr:net.IP(nil), Vlan:0, VNI:0}

    Tested on mainline (v4.19-rc6) and net-next (3bd09b05b068).

    References:

    [1] netlink library for go (test-case)
    https://github.com/vishvananda/netlink

    $ cat ~/go/src/neighlist/main.go
    package main
    import ("fmt"; "syscall"; "github.com/vishvananda/netlink")
    func main() {
    neighs, _ := netlink.NeighList(0, syscall.AF_BRIDGE)
    for _, neigh := range neighs { fmt.Printf("%#v\n", neigh) }
    }

    $ export GOPATH=~/go
    $ go get github.com/vishvananda/netlink
    $ go build neighlist
    $ ~/go/src/neighlist/neighlist

    Thanks to David Ahern for suggestions to improve this patch.

    Fixes: 0ff50e83b512 ("net: rtnetlink: bail out from rtnl_fdb_dump() on parse error")
    Fixes: 5e6d24358799 ("bridge: netlink dump interface at par with brctl")
    Reported-by: Aidan Obley
    Signed-off-by: Mauricio Faria de Oliveira
    Reviewed-by: David Ahern
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Mauricio Faria de Oliveira
     
  • [ Upstream commit 8b4c3cdd9dd8290343ce959a132d3b334062c5b9 ]

    A number of TC attributes are processed without proper validation
    (e.g., length checks). Add a tca policy for all input attributes and use
    when invoking nlmsg_parse.

    The 2 Fixes tags below cover the latest additions. The other attributes
    are a string (KIND), nested attribute (OPTIONS which does seem to have
    validation in most cases), for dumps only or a flag.

    Fixes: 5bc1701881e39 ("net: sched: introduce multichain support for filters")
    Fixes: d47a6b0e7c492 ("net: sched: introduce ingress/egress block index attributes for qdisc")
    Signed-off-by: David Ahern
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    David Ahern
     
  • [ Upstream commit f88b4c01b97e09535505cf3c327fdbce55c27f00 ]

    netlbl_unlabel_addrinfo_get() assumes that if it finds the
    NLBL_UNLABEL_A_IPV4ADDR attribute, it must also have the
    NLBL_UNLABEL_A_IPV4MASK attribute as well. However, this is
    not necessarily the case as the current checks in
    netlbl_unlabel_staticadd() and friends are not sufficent to
    enforce this.

    If passed a netlink message with NLBL_UNLABEL_A_IPV4ADDR,
    NLBL_UNLABEL_A_IPV6ADDR, and NLBL_UNLABEL_A_IPV6MASK attributes,
    these functions will all call netlbl_unlabel_addrinfo_get() which
    will then attempt dereference NULL when fetching the non-existent
    NLBL_UNLABEL_A_IPV4MASK attribute:

    Unable to handle kernel NULL pointer dereference at virtual address 0
    Process unlab (pid: 31762, stack limit = 0xffffff80502d8000)
    Call trace:
    netlbl_unlabel_addrinfo_get+0x44/0xd8
    netlbl_unlabel_staticremovedef+0x98/0xe0
    genl_rcv_msg+0x354/0x388
    netlink_rcv_skb+0xac/0x118
    genl_rcv+0x34/0x48
    netlink_unicast+0x158/0x1f0
    netlink_sendmsg+0x32c/0x338
    sock_sendmsg+0x44/0x60
    ___sys_sendmsg+0x1d0/0x2a8
    __sys_sendmsg+0x64/0xb4
    SyS_sendmsg+0x34/0x4c
    el0_svc_naked+0x34/0x38
    Code: 51001149 7100113f 540000a0 f9401508 (79400108)
    ---[ end trace f6438a488e737143 ]---
    Kernel panic - not syncing: Fatal exception

    Signed-off-by: Sean Tranchetti

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

    Sean Tranchetti
     
  • [ Upstream commit 86f9bd1ff61c413a2a251fa736463295e4e24733 ]

    The backend handling for /proc/net/if_inet6 in addrconf.c doesn't properly
    handle starting/stopping the iteration. The problem is that at some point
    during the iteration, an overflow is detected and the process is
    subsequently stopped. The item being shown via seq_printf() when the
    overflow occurs is not actually shown, though. When start() is
    subsequently called to resume iterating, it returns the next item, and
    thus the item that was being processed when the overflow occurred never
    gets printed.

    Alter the meaning of the private data member "offset". Currently, when it
    is not 0 (which only happens at the very beginning), "offset" represents
    the next hlist item to be printed. After this change, "offset" always
    represents the current item.

    This is also consistent with the private data member "bucket", which
    represents the current bucket, and also the use of "pos" as defined in
    seq_file.txt:
    The pos passed to start() will always be either zero, or the most
    recent pos used in the previous session.

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

    Jeff Barnhill
     
  • [ Upstream commit af7d6cce53694a88d6a1bb60c9a239a6a5144459 ]

    Since commit 5aad1de5ea2c ("ipv4: use separate genid for next hop
    exceptions"), exceptions get deprecated separately from cached
    routes. In particular, administrative changes don't clear PMTU anymore.

    As Stefano described in commit e9fa1495d738 ("ipv6: Reflect MTU changes
    on PMTU of exceptions for MTU-less routes"), the PMTU discovered before
    the local MTU change can become stale:
    - if the local MTU is now lower than the PMTU, that PMTU is now
    incorrect
    - if the local MTU was the lowest value in the path, and is increased,
    we might discover a higher PMTU

    Similarly to what commit e9fa1495d738 did for IPv6, update PMTU in those
    cases.

    If the exception was locked, the discovered PMTU was smaller than the
    minimal accepted PMTU. In that case, if the new local MTU is smaller
    than the current PMTU, let PMTU discovery figure out if locking of the
    exception is still needed.

    To do this, we need to know the old link MTU in the NETDEV_CHANGEMTU
    notifier. By the time the notifier is called, dev->mtu has been
    changed. This patch adds the old MTU as additional information in the
    notifier structure, and a new call_netdevice_notifiers_u32() function.

    Fixes: 5aad1de5ea2c ("ipv4: use separate genid for next hop exceptions")
    Signed-off-by: Sabrina Dubroca
    Reviewed-by: Stefano Brivio
    Reviewed-by: David Ahern
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Sabrina Dubroca
     
  • [ Upstream commit a688caa34beb2fd2a92f1b6d33e40cde433ba160 ]

    In rawv6_send_hdrinc(), in order to avoid an extra dst_hold(), we
    directly assign the dst to skb and set passed in dst to NULL to avoid
    double free.
    However, in error case, we free skb and then do stats update with the
    dst pointer passed in. This causes use-after-free on the dst.
    Fix it by taking rcu read lock right before dst could get released to
    make sure dst does not get freed until the stats update is done.
    Note: we don't have this issue in ipv4 cause dst is not used for stats
    update in v4.

    Syzkaller reported following crash:
    BUG: KASAN: use-after-free in rawv6_send_hdrinc net/ipv6/raw.c:692 [inline]
    BUG: KASAN: use-after-free in rawv6_sendmsg+0x4421/0x4630 net/ipv6/raw.c:921
    Read of size 8 at addr ffff8801d95ba730 by task syz-executor0/32088

    CPU: 1 PID: 32088 Comm: syz-executor0 Not tainted 4.19.0-rc2+ #93
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    Call Trace:
    __dump_stack lib/dump_stack.c:77 [inline]
    dump_stack+0x1c4/0x2b4 lib/dump_stack.c:113
    print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
    kasan_report_error mm/kasan/report.c:354 [inline]
    kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
    __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
    rawv6_send_hdrinc net/ipv6/raw.c:692 [inline]
    rawv6_sendmsg+0x4421/0x4630 net/ipv6/raw.c:921
    inet_sendmsg+0x1a1/0x690 net/ipv4/af_inet.c:798
    sock_sendmsg_nosec net/socket.c:621 [inline]
    sock_sendmsg+0xd5/0x120 net/socket.c:631
    ___sys_sendmsg+0x7fd/0x930 net/socket.c:2114
    __sys_sendmsg+0x11d/0x280 net/socket.c:2152
    __do_sys_sendmsg net/socket.c:2161 [inline]
    __se_sys_sendmsg net/socket.c:2159 [inline]
    __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2159
    do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
    entry_SYSCALL_64_after_hwframe+0x49/0xbe
    RIP: 0033:0x457099
    Code: fd b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 3d 01 f0 ff ff 0f 83 cb b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
    RSP: 002b:00007f83756edc78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
    RAX: ffffffffffffffda RBX: 00007f83756ee6d4 RCX: 0000000000457099
    RDX: 0000000000000000 RSI: 0000000020003840 RDI: 0000000000000004
    RBP: 00000000009300a0 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
    R13: 00000000004d4b30 R14: 00000000004c90b1 R15: 0000000000000000

    Allocated by task 32088:
    save_stack+0x43/0xd0 mm/kasan/kasan.c:448
    set_track mm/kasan/kasan.c:460 [inline]
    kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
    kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
    kmem_cache_alloc+0x12e/0x730 mm/slab.c:3554
    dst_alloc+0xbb/0x1d0 net/core/dst.c:105
    ip6_dst_alloc+0x35/0xa0 net/ipv6/route.c:353
    ip6_rt_cache_alloc+0x247/0x7b0 net/ipv6/route.c:1186
    ip6_pol_route+0x8f8/0xd90 net/ipv6/route.c:1895
    ip6_pol_route_output+0x54/0x70 net/ipv6/route.c:2093
    fib6_rule_lookup+0x277/0x860 net/ipv6/fib6_rules.c:122
    ip6_route_output_flags+0x2c5/0x350 net/ipv6/route.c:2121
    ip6_route_output include/net/ip6_route.h:88 [inline]
    ip6_dst_lookup_tail+0xe27/0x1d60 net/ipv6/ip6_output.c:951
    ip6_dst_lookup_flow+0xc8/0x270 net/ipv6/ip6_output.c:1079
    rawv6_sendmsg+0x12d9/0x4630 net/ipv6/raw.c:905
    inet_sendmsg+0x1a1/0x690 net/ipv4/af_inet.c:798
    sock_sendmsg_nosec net/socket.c:621 [inline]
    sock_sendmsg+0xd5/0x120 net/socket.c:631
    ___sys_sendmsg+0x7fd/0x930 net/socket.c:2114
    __sys_sendmsg+0x11d/0x280 net/socket.c:2152
    __do_sys_sendmsg net/socket.c:2161 [inline]
    __se_sys_sendmsg net/socket.c:2159 [inline]
    __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2159
    do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
    entry_SYSCALL_64_after_hwframe+0x49/0xbe

    Freed by task 5356:
    save_stack+0x43/0xd0 mm/kasan/kasan.c:448
    set_track mm/kasan/kasan.c:460 [inline]
    __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
    kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
    __cache_free mm/slab.c:3498 [inline]
    kmem_cache_free+0x83/0x290 mm/slab.c:3756
    dst_destroy+0x267/0x3c0 net/core/dst.c:141
    dst_destroy_rcu+0x16/0x19 net/core/dst.c:154
    __rcu_reclaim kernel/rcu/rcu.h:236 [inline]
    rcu_do_batch kernel/rcu/tree.c:2576 [inline]
    invoke_rcu_callbacks kernel/rcu/tree.c:2880 [inline]
    __rcu_process_callbacks kernel/rcu/tree.c:2847 [inline]
    rcu_process_callbacks+0xf23/0x2670 kernel/rcu/tree.c:2864
    __do_softirq+0x30b/0xad8 kernel/softirq.c:292

    Fixes: 1789a640f556 ("raw: avoid two atomics in xmit")
    Signed-off-by: Wei Wang
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Wei Wang
     
  • [ Upstream commit 64199fc0a46ba211362472f7f942f900af9492fd ]

    Caching ip_hdr(skb) before a call to pskb_may_pull() is buggy,
    do not do it.

    Fixes: 2efd4fca703a ("ip: in cmsg IP(V6)_ORIGDSTADDR call pskb_may_pull")
    Signed-off-by: Eric Dumazet
    Cc: Willem de Bruijn
    Reported-by: syzbot
    Acked-by: Willem de Bruijn
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • [ Upstream commit ccfec9e5cb2d48df5a955b7bf47f7782157d3bc2]

    Cong noted that we need the same checks introduced by commit 76c0ddd8c3a6
    ("ip6_tunnel: be careful when accessing the inner header")
    even for ipv4 tunnels.

    Fixes: c54419321455 ("GRE: Refactor GRE tunneling code.")
    Suggested-by: Cong Wang
    Signed-off-by: Paolo Abeni
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Paolo Abeni
     
  • [ Upstream commit 76c0ddd8c3a683f6e2c6e60e11dc1a1558caf4bc ]

    the ip6 tunnel xmit ndo assumes that the processed skb always
    contains an ip[v6] header, but syzbot has found a way to send
    frames that fall short of this assumption, leading to the following splat:

    BUG: KMSAN: uninit-value in ip6ip6_tnl_xmit net/ipv6/ip6_tunnel.c:1307
    [inline]
    BUG: KMSAN: uninit-value in ip6_tnl_start_xmit+0x7d2/0x1ef0
    net/ipv6/ip6_tunnel.c:1390
    CPU: 0 PID: 4504 Comm: syz-executor558 Not tainted 4.16.0+ #87
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
    Google 01/01/2011
    Call Trace:
    __dump_stack lib/dump_stack.c:17 [inline]
    dump_stack+0x185/0x1d0 lib/dump_stack.c:53
    kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067
    __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:683
    ip6ip6_tnl_xmit net/ipv6/ip6_tunnel.c:1307 [inline]
    ip6_tnl_start_xmit+0x7d2/0x1ef0 net/ipv6/ip6_tunnel.c:1390
    __netdev_start_xmit include/linux/netdevice.h:4066 [inline]
    netdev_start_xmit include/linux/netdevice.h:4075 [inline]
    xmit_one net/core/dev.c:3026 [inline]
    dev_hard_start_xmit+0x5f1/0xc70 net/core/dev.c:3042
    __dev_queue_xmit+0x27ee/0x3520 net/core/dev.c:3557
    dev_queue_xmit+0x4b/0x60 net/core/dev.c:3590
    packet_snd net/packet/af_packet.c:2944 [inline]
    packet_sendmsg+0x7c70/0x8a30 net/packet/af_packet.c:2969
    sock_sendmsg_nosec net/socket.c:630 [inline]
    sock_sendmsg net/socket.c:640 [inline]
    ___sys_sendmsg+0xec0/0x1310 net/socket.c:2046
    __sys_sendmmsg+0x42d/0x800 net/socket.c:2136
    SYSC_sendmmsg+0xc4/0x110 net/socket.c:2167
    SyS_sendmmsg+0x63/0x90 net/socket.c:2162
    do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
    entry_SYSCALL_64_after_hwframe+0x3d/0xa2
    RIP: 0033:0x441819
    RSP: 002b:00007ffe58ee8268 EFLAGS: 00000213 ORIG_RAX: 0000000000000133
    RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000441819
    RDX: 0000000000000002 RSI: 0000000020000100 RDI: 0000000000000003
    RBP: 00000000006cd018 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000213 R12: 0000000000402510
    R13: 00000000004025a0 R14: 0000000000000000 R15: 0000000000000000

    Uninit was created at:
    kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline]
    kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:188
    kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:314
    kmsan_slab_alloc+0x11/0x20 mm/kmsan/kmsan.c:321
    slab_post_alloc_hook mm/slab.h:445 [inline]
    slab_alloc_node mm/slub.c:2737 [inline]
    __kmalloc_node_track_caller+0xaed/0x11c0 mm/slub.c:4369
    __kmalloc_reserve net/core/skbuff.c:138 [inline]
    __alloc_skb+0x2cf/0x9f0 net/core/skbuff.c:206
    alloc_skb include/linux/skbuff.h:984 [inline]
    alloc_skb_with_frags+0x1d4/0xb20 net/core/skbuff.c:5234
    sock_alloc_send_pskb+0xb56/0x1190 net/core/sock.c:2085
    packet_alloc_skb net/packet/af_packet.c:2803 [inline]
    packet_snd net/packet/af_packet.c:2894 [inline]
    packet_sendmsg+0x6454/0x8a30 net/packet/af_packet.c:2969
    sock_sendmsg_nosec net/socket.c:630 [inline]
    sock_sendmsg net/socket.c:640 [inline]
    ___sys_sendmsg+0xec0/0x1310 net/socket.c:2046
    __sys_sendmmsg+0x42d/0x800 net/socket.c:2136
    SYSC_sendmmsg+0xc4/0x110 net/socket.c:2167
    SyS_sendmmsg+0x63/0x90 net/socket.c:2162
    do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
    entry_SYSCALL_64_after_hwframe+0x3d/0xa2

    This change addresses the issue adding the needed check before
    accessing the inner header.

    The ipv4 side of the issue is apparently there since the ipv4 over ipv6
    initial support, and the ipv6 side predates git history.

    Fixes: c4d3efafcc93 ("[IPV6] IP6TUNNEL: Add support to IPv4 over IPv6 tunnel.")
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzbot+3fde91d4d394747d6db4@syzkaller.appspotmail.com
    Tested-by: Alexander Potapenko
    Signed-off-by: Paolo Abeni
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Paolo Abeni
     

13 Oct, 2018

2 commits

  • commit f394ad28feffbeebab77c8bf9a203bd49b957c9a upstream.

    Currently, rds_ib_conn_alloc() calls rds_ib_recv_alloc_caches()
    without passing along the gfp_t flag. But rds_ib_recv_alloc_caches()
    and rds_ib_recv_alloc_cache() should take a gfp_t parameter so that
    rds_ib_recv_alloc_cache() can call alloc_percpu_gfp() using the
    correct flag instead of calling alloc_percpu().

    Signed-off-by: Ka-Cheong Poon
    Acked-by: Santosh Shilimkar
    Signed-off-by: David S. Miller
    Cc: Håkon Bugge
    Signed-off-by: Greg Kroah-Hartman

    Ka-Cheong Poon
     
  • commit 211710ca74adf790b46ab3867fcce8047b573cd1 upstream.

    key->sta is only valid after ieee80211_key_link, which is called later
    in this function. Because of that, the IEEE80211_KEY_FLAG_RX_MGMT is
    never set when management frame protection is enabled.

    Fixes: e548c49e6dc6b ("mac80211: add key flag for management keys")
    Cc: stable@vger.kernel.org
    Signed-off-by: Felix Fietkau
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Felix Fietkau
     

10 Oct, 2018

8 commits

  • [ Upstream commit 7acfda539c0b9636a58bfee56abfb3aeee806d96 ]

    When element of verdict map is deleted, the delete routine should
    release chain. however, flush element of verdict map routine doesn't
    release chain.

    test commands:
    %nft add table ip filter
    %nft add chain ip filter c1
    %nft add map ip filter map1 { type ipv4_addr : verdict \; }
    %nft add element ip filter map1 { 1 : jump c1 }
    %nft flush map ip filter map1
    %nft flush ruleset

    splat looks like:
    [ 4895.170899] kernel BUG at net/netfilter/nf_tables_api.c:1415!
    [ 4895.178114] invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI
    [ 4895.178880] CPU: 0 PID: 1670 Comm: nft Not tainted 4.18.0+ #55
    [ 4895.178880] RIP: 0010:nf_tables_chain_destroy.isra.28+0x39/0x220 [nf_tables]
    [ 4895.178880] Code: fc ff df 53 48 89 fb 48 83 c7 50 48 89 fa 48 c1 ea 03 0f b6 04 02 84 c0 74 09 3c 03 7f 05 e8 3e 4c 25 e1 8b 43 50 85 c0 74 02 0b 48 89 da 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 80 3c 02
    [ 4895.228342] RSP: 0018:ffff88010b98f4c0 EFLAGS: 00010202
    [ 4895.234841] RAX: 0000000000000001 RBX: ffff8801131c6968 RCX: ffff8801146585b0
    [ 4895.234841] RDX: 1ffff10022638d37 RSI: ffff8801191a9348 RDI: ffff8801131c69b8
    [ 4895.234841] RBP: ffff8801146585a8 R08: 1ffff1002323526a R09: 0000000000000000
    [ 4895.234841] R10: 0000000000000000 R11: 0000000000000000 R12: dead000000000200
    [ 4895.234841] R13: dead000000000100 R14: ffffffffa3638af8 R15: dffffc0000000000
    [ 4895.234841] FS: 00007f6d188e6700(0000) GS:ffff88011b600000(0000) knlGS:0000000000000000
    [ 4895.234841] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 4895.234841] CR2: 00007ffe72b8df88 CR3: 000000010e2d4000 CR4: 00000000001006f0
    [ 4895.234841] Call Trace:
    [ 4895.234841] nf_tables_commit+0x2704/0x2c70 [nf_tables]
    [ 4895.234841] ? nfnetlink_rcv_batch+0xa4f/0x11b0 [nfnetlink]
    [ 4895.234841] ? nf_tables_setelem_notify.constprop.48+0x1a0/0x1a0 [nf_tables]
    [ 4895.323824] ? __lock_is_held+0x9d/0x130
    [ 4895.323824] ? kasan_unpoison_shadow+0x30/0x40
    [ 4895.333299] ? kasan_kmalloc+0xa9/0xc0
    [ 4895.333299] ? kmem_cache_alloc_trace+0x2c0/0x310
    [ 4895.333299] ? nfnetlink_rcv_batch+0xa4f/0x11b0 [nfnetlink]
    [ 4895.333299] nfnetlink_rcv_batch+0xdb9/0x11b0 [nfnetlink]
    [ 4895.333299] ? debug_show_all_locks+0x290/0x290
    [ 4895.333299] ? nfnetlink_net_init+0x150/0x150 [nfnetlink]
    [ 4895.333299] ? sched_clock_cpu+0xe5/0x170
    [ 4895.333299] ? sched_clock_local+0xff/0x130
    [ 4895.333299] ? sched_clock_cpu+0xe5/0x170
    [ 4895.333299] ? find_held_lock+0x39/0x1b0
    [ 4895.333299] ? sched_clock_local+0xff/0x130
    [ 4895.333299] ? memset+0x1f/0x40
    [ 4895.333299] ? nla_parse+0x33/0x260
    [ 4895.333299] ? ns_capable_common+0x6e/0x110
    [ 4895.333299] nfnetlink_rcv+0x2c0/0x310 [nfnetlink]
    [ ... ]

    Fixes: 591054469b3e ("netfilter: nf_tables: revisit chain/object refcounting from elements")
    Signed-off-by: Taehee Yoo
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Taehee Yoo
     
  • [ Upstream commit c1dc2912059901f97345d9e10c96b841215fdc0f ]

    The cluster match requires conntrack for matching packets. If the
    netns does not have conntrack hooks registered, the match does not
    work at all.

    Implicitly load the conntrack hook for the family, exactly as many
    other extensions do. This ensures that the match works even if the
    hooks have not been registered by other means.

    Signed-off-by: Martin Willi
    Acked-by: Florian Westphal
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Martin Willi
     
  • [ Upstream commit c6e57b3896fc76299913b8cfd82d853bee8a2c84 ]

    When tracing is enabled, all the debug messages are recorded and must
    not exceed MAX_MSG_LEN (100) columns. Longer debug messages grant the
    user with:

    WARNING: CPU: 3 PID: 32642 at /tmp/wifi-core-20180806094828/src/iwlwifi-stack-dev/net/mac80211/./trace_msg.h:32 trace_event_raw_event_mac80211_msg_event+0xab/0xc0 [mac80211]
    Workqueue: phy1 ieee80211_iface_work [mac80211]
    RIP: 0010:trace_event_raw_event_mac80211_msg_event+0xab/0xc0 [mac80211]
    Call Trace:
    __sdata_dbg+0xbd/0x120 [mac80211]
    ieee80211_ibss_rx_queued_mgmt+0x15f/0x510 [mac80211]
    ieee80211_iface_work+0x21d/0x320 [mac80211]

    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Emmanuel Grumbach
     
  • [ Upstream commit 6c18b27d6e5c6a7206364eae2b47bc8d8b2fa68f ]

    If the driver fails to properly prepare for the channel
    switch, mac80211 will disconnect. If the CSA IE had mode
    set to 1, it means that the clients are not allowed to send
    any Tx on the current channel, and that includes the
    deauthentication frame.

    Make sure that we don't send the deauthentication frame in
    this case.

    In iwlwifi, this caused a failure to flush queues since the
    firmware already closed the queues after having parsed the
    CSA IE. Then mac80211 would wait until the deauthentication
    frame would go out (drv_flush(drop=false)) and that would
    never happen.

    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Emmanuel Grumbach
     
  • [ Upstream commit 0007e94355fdb71a1cf5dba0754155cba08f0666 ]

    When performing a channel switch flow for a managed interface, the
    flow did not update the bandwidth of the AP station and the rate
    scale algorithm. In case of a channel width downgrade, this would
    result with the rate scale algorithm using a bandwidth that does not
    match the interface channel configuration.

    Fix this by updating the AP station bandwidth and rate scaling algorithm
    before the actual channel change in case of a bandwidth downgrade, or
    after the actual channel change in case of a bandwidth upgrade.

    Signed-off-by: Ilan Peer
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Ilan Peer
     
  • [ Upstream commit f3ffb6c3a28963657eb8b02a795d75f2ebbd5ef4 ]

    We hit a problem with iwlwifi that was caused by a bug in
    mac80211. A bug in iwlwifi caused the firwmare to crash in
    certain cases in channel switch. Because of that bug,
    drv_pre_channel_switch would fail and trigger the restart
    flow.
    Now we had the hw restart worker which runs on the system's
    workqueue and the csa_connection_drop_work worker that runs
    on mac80211's workqueue that can run together. This is
    obviously problematic since the restart work wants to
    reconfigure the connection, while the csa_connection_drop_work
    worker does the exact opposite: it tries to disconnect.

    Fix this by cancelling the csa_connection_drop_work worker
    in the restart worker.

    Note that this can sound racy: we could have:

    driver iface_work CSA_work restart_work
    +++++++++++++++++++++++++++++++++++++++++++++
    |

    -CS FAILED-->
    | |
    | cancel_work(CSA)
    schedule |
    CSA work |
    | |
    Race between those 2

    But this is not possible because we flush the workqueue
    in the restart worker before we cancel the CSA worker.
    That would be bullet proof if we could guarantee that
    we schedule the CSA worker only from the iface_work
    which runs on the workqueue (and not on the system's
    workqueue), but unfortunately we do have an instance
    in which we schedule the CSA work outside the context
    of the workqueue (ieee80211_chswitch_done).

    Note also that we should probably cancel other workers
    like beacon_connection_loss_work and possibly others
    for different types of interfaces, at the very least,
    IBSS should suffer from the exact same problem, but for
    now, do the minimum to fix the actual bug that was actually
    experienced and reproduced.

    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Emmanuel Grumbach
     
  • [ Upstream commit 8442938c3a2177ba16043b3a935f2c78266ad399 ]

    The "chandef->center_freq1" variable is a u32 but "freq" is a u16 so we
    are truncating away the high bits. I noticed this bug because in commit
    9cf0a0b4b64a ("cfg80211: Add support for 60GHz band channels 5 and 6")
    we made "freq
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     
  • [ Upstream commit 66eb02d839e8495ae6b612e2d09ff599374b80e2 ]

    Initialize 'n' to 2 in order to take into account also the first
    packet in the estimation of max_subframe limit for a given A-MSDU
    since frag_tail pointer is NULL when ieee80211_amsdu_aggregate
    routine analyzes the second frame.

    Fixes: 6e0456b54545 ("mac80211: add A-MSDU tx support")
    Signed-off-by: Lorenzo Bianconi
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Lorenzo Bianconi