Skip to content

Commit

Permalink
origin
Browse files Browse the repository at this point in the history
GIT 184ca823481c99dadd7d946e5afd4bb921eab30d

commit b5ac851885accffe0485aea2805df8f2d49c95a8
Author: Roman Mashak <mrv@mojatatu.com>
Date:   Sat Aug 13 22:35:02 2016 -0700

    net_sched: allow flushing tc police actions
    
    The act_police uses its own code to walk the
    action hashtable, which leads to that we could
    not flush standalone tc police actions, so just
    switch to tcf_generic_walker() like other actions.
    
    (Joint work from Roman and Cong.)
    
    Signed-off-by: Roman Mashak <mrv@mojatatu.com>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 0852e455238f8550fa92b1e40355eb2c6805787e
Author: WANG Cong <xiyou.wangcong@gmail.com>
Date:   Sat Aug 13 22:35:01 2016 -0700

    net_sched: unify the init logic for act_police
    
    Jamal reported a crash when we create a police action
    with a specific index, this is because the init logic
    is not correct, we should always create one for this
    case. Just unify the logic with other tc actions.
    
    Fixes: a03e6fe56971 ("act_police: fix a crash during removal")
    Reported-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 22dc13c837c33207548c8ee5116b64e2930a6e23
Author: WANG Cong <xiyou.wangcong@gmail.com>
Date:   Sat Aug 13 22:35:00 2016 -0700

    net_sched: convert tcf_exts from list to pointer array
    
    As pointed out by Jamal, an action could be shared by
    multiple filters, so we can't use list to chain them
    any more after we get rid of the original tc_action.
    Instead, we could just save pointers to these actions
    in tcf_exts, since they are refcount'ed, so convert
    the list to an array of pointers.
    
    The "ugly" part is the action API still accepts list
    as a parameter, I just introduce a helper function to
    convert the array of pointers to a list, instead of
    relying on the C99 feature to iterate the array.
    
    Fixes: a85a970af265 ("net_sched: move tc_action into tcf_common")
    Reported-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Cc: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 2734437ef3c2943090d0914bf91caa6b30451615
Author: WANG Cong <xiyou.wangcong@gmail.com>
Date:   Sat Aug 13 22:34:59 2016 -0700

    net_sched: move tc offload macros to pkt_cls.h
    
    struct tcf_exts belongs to filters, should not be visible
    to plain tc actions.
    
    Cc: Ido Schimmel <idosch@mellanox.com>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 0c23c3e705691cfb99c94f2760df2b456fe45194
Author: WANG Cong <xiyou.wangcong@gmail.com>
Date:   Sat Aug 13 22:34:58 2016 -0700

    net_sched: fix a typo in tc_for_each_action()
    
    It is harmless because all users pass 'a' to this macro.
    
    Fixes: 00175aec941e ("net/sched: Macro instead of CONFIG_NET_CLS_ACT ifdef")
    Cc: Amir Vadai <amir@vadai.me>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 824a7e8863b3eb283343f891b11a782b4ec0d0de
Author: WANG Cong <xiyou.wangcong@gmail.com>
Date:   Sat Aug 13 22:34:57 2016 -0700

    net_sched: remove an unnecessary list_del()
    
    This list_del() for tc action is not needed actually,
    because we only use this list to chain bulk operations,
    therefore should not be carried for latter operations.
    
    Fixes: ec0595cc4495 ("net_sched: get rid of struct tcf_common")
    Cc: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit f07fed82ad7994cc4d779ee79bdf7a46848c4b8f
Author: WANG Cong <xiyou.wangcong@gmail.com>
Date:   Sat Aug 13 22:34:56 2016 -0700

    net_sched: remove the leftover cleanup_a()
    
    After refactoring tc_action into tcf_common, we no
    longer need to cleanup temporary "actions" in list,
    they are permanently stored in the hashtable.
    
    Fixes: a85a970af265 ("net_sched: move tc_action into tcf_common")
    Reported-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Cc: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 9ffcc3725f096e9f0d985f738b0e44214cd72d93
Author: Ido Schimmel <idosch@mellanox.com>
Date:   Wed Aug 17 16:39:37 2016 +0200

    mlxsw: spectrum: Allow packets to be trapped from any PG
    
    When packets enter the device they are classified to a priority group
    (PG) buffer based on their PCP value. After their egress port and
    traffic class are determined they are moved to the switch's shared
    buffer and await transmission, if:
    
    (Ingress{Port}.Usage < Thres && Ingress{Port,PG}.Usage < Thres &&
     Egress{Port}.Usage < Thres && Egress{Port,TC}.Usage < Thres)
    ||
    (Ingress{Port}.Usage < Min || Ingress{Port,PG} < Min ||
     Egress{Port}.Usage < Min || Egress{Port,TC}.Usage < Min)
    
    Packets scheduled to transmission through CPU port (trapped to CPU) use
    traffic class 7, which has a zero maximum and minimum quotas. However,
    when such packets arrive from PG 0 they are admitted to the shared
    buffer as PG 0 has a non-zero minimum quota.
    
    Allow all packets to be trapped to the CPU - regardless of the PG they
    were classified to - by assigning a 10KB minimum quota for CPU port and
    TC7.
    
    Fixes: 8e8dfe9fdf06 ("mlxsw: spectrum: Add IEEE 802.1Qaz ETS support")
    Reported-by: Tamir Winetroub <tamirw@mellanox.com>
    Tested-by: Tamir Winetroub <tamirw@mellanox.com>
    Signed-off-by: Ido Schimmel <idosch@mellanox.com>
    Signed-off-by: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 8168287b5dfac9227a549ed87f5e111b7005e8a4
Author: Ido Schimmel <idosch@mellanox.com>
Date:   Wed Aug 17 16:39:36 2016 +0200

    mlxsw: spectrum: Unmap 802.1Q FID before destroying it
    
    Before destroying the 802.1Q FID we should first remove the VID-to-FID
    mapping. This makes mlxsw_sp_fid_destroy() symmetric with regards to
    mlxsw_sp_fid_create().
    
    Fixes: 14d39461b3f4 ("mlxsw: spectrum: Use per-FID struct for the VLAN-aware bridge")
    Signed-off-by: Ido Schimmel <idosch@mellanox.com>
    Signed-off-by: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 0583272d91f0f4e21f1eb666786286863185be7e
Author: Ido Schimmel <idosch@mellanox.com>
Date:   Wed Aug 17 16:39:35 2016 +0200

    mlxsw: spectrum: Add missing rollbacks in error path
    
    While going over the code I noticed we are missing two rollbacks in the
    port's creation error path. Add them and adjust the place of one of them
    in the port's removal sequence so that both are symmetric.
    
    Fixes: 56ade8fe3fe1 ("mlxsw: spectrum: Add initial support for Spectrum ASIC")
    Signed-off-by: Ido Schimmel <idosch@mellanox.com>
    Signed-off-by: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 0e7df1a290abbcf3ecf697bbbbd4549c9a113db0
Author: Jiri Pirko <jiri@mellanox.com>
Date:   Wed Aug 17 16:39:34 2016 +0200

    mlxsw: reg: Fix missing op field fill-up
    
    Ralue pack function needs to set op, otherwise it is 0 for add always.
    
    Fixes: d5a1c749d22 ("mlxsw: reg: Add Router Algorithmic LPM Unicast Entry Register definition")
    Signed-off-by: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit a94a614fa2bd32848a67f8261228e193beb826ca
Author: Ido Schimmel <idosch@mellanox.com>
Date:   Wed Aug 17 16:39:33 2016 +0200

    mlxsw: spectrum: Trap loop-backed packets
    
    One of the conditions to generate an ICMP Redirect Message is that "the
    packet is being forwarded out the same physical interface that it was
    received from" (RFC 1812).
    
    Therefore, we need to be able to trap such packets and let the kernel
    decide what to do with them.
    
    For each RIF, enable the loop-back filter, which will raise the LBERROR
    trap whenever the ingress RIF equals the egress RIF.
    
    Fixes: 99724c18fc66 ("mlxsw: spectrum: Introduce support for router interfaces")
    Reported-by: Ilan Tayari <ilant@mellanox.com>
    Signed-off-by: Ido Schimmel <idosch@mellanox.com>
    Signed-off-by: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit c20b80187a93b4fcc1c5c46fc8a436df1f17636d
Author: Elad Raz <eladr@mellanox.com>
Date:   Wed Aug 17 16:39:32 2016 +0200

    mlxsw: spectrum: Add missing packet traps
    
    Add the following traps:
    
    1) MTU Error: Trap packets whose size is bigger than the egress RIF's
    MTU. If DF bit isn't set, traffic will continue to be routed in slow
    path.
    
    2) TTL Error: Trap packets whose TTL expired. This allows traceroute to
    work properly.
    
    3) OSPF packets.
    
    Fixes: 7b27ce7bb9cd ("mlxsw: spectrum: Add traps needed for router implementation")
    Signed-off-by: Elad Raz <eladr@mellanox.com>
    Signed-off-by: Ido Schimmel <idosch@mellanox.com>
    Signed-off-by: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 2f25844c233650b2abb92b66b3d0af7d73b5f88f
Author: Ido Schimmel <idosch@mellanox.com>
Date:   Wed Aug 17 16:39:31 2016 +0200

    mlxsw: spectrum: Mark port as active before registering it
    
    Commit bbf2a4757b30 ("mlxsw: spectrum: Initialize ports at the end of
    init sequence") moved ports initialization to the end of the init
    sequence, which means ports are the first to be removed during fini.
    
    Since the FDB delayed work is still active when ports are removed it's
    possible for it to process FDB notifications of inactive ports,
    resulting in a warning message.
    
    Fix that by marking ports as inactive only after unregistering them. The
    NETDEV_UNREGISTER event will invoke bridge's driver port removal
    sequence that will cause the FDB (and FDB notifications) to be flushed.
    
    Fixes: bbf2a4757b30 ("mlxsw: spectrum: Initialize ports at the end of init sequence")
    Signed-off-by: Ido Schimmel <idosch@mellanox.com>
    Signed-off-by: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 05978481e77e47b0bcb1767d3783fa0e5a18f399
Author: Ido Schimmel <idosch@mellanox.com>
Date:   Wed Aug 17 16:39:30 2016 +0200

    mlxsw: spectrum: Create PVID vPort before registering netdevice
    
    After registering a netdevice it's possible for user space applications
    to configure an IP address on it. From the driver's perspective, this
    means a router interface (RIF) should be created for the PVID vPort.
    
    Therefore, we must create the PVID vPort before registering the
    netdevice.
    
    Fixes: 99724c18fc66 ("mlxsw: spectrum: Introduce support for router interfaces")
    Signed-off-by: Ido Schimmel <idosch@mellanox.com>
    Signed-off-by: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit fa66d7e3fea7504e241e9004998af2c71814da18
Author: Ido Schimmel <idosch@mellanox.com>
Date:   Wed Aug 17 16:39:29 2016 +0200

    mlxsw: spectrum: Remove redundant errors from the code
    
    Currently, when device configuration fails we emit errors to the kernel
    log despite the fact we already get these from the EMAD transaction
    layer, so remove them.
    
    In addition to being unnecessary, removing these error messages will
    allow us to reuse mlxsw_sp_port_add_vid() to create the PVID vPort
    before registering the netdevice.
    
    Fixes: 99724c18fc66 ("mlxsw: spectrum: Introduce support for router interfaces")
    Signed-off-by: Ido Schimmel <idosch@mellanox.com>
    Signed-off-by: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 7a35583ec5b64f17559c9de8d7c47f7360e40362
Author: Ido Schimmel <idosch@mellanox.com>
Date:   Wed Aug 17 16:39:28 2016 +0200

    mlxsw: spectrum: Don't return upon error in removal path
    
    When removing a VLAN filter from the device we shouldn't return upon the
    first error we encounter, as otherwise we'll have resources that will
    never be freed nor used.
    
    Instead, we should keep trying to free as much resources as possible in
    a best effort mode.
    
    Remove the error message as well, since we already get these from the
    EMAD transaction code.
    
    Fixes: 99724c18fc66 ("mlxsw: spectrum: Introduce support for router interfaces")
    Signed-off-by: Ido Schimmel <idosch@mellanox.com>
    Signed-off-by: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit fbfe12c64f9650aa22f434dd9dd22df7ddf63221
Author: Dave Ertman <david.m.ertman@intel.com>
Date:   Fri Aug 12 09:56:32 2016 -0700

    i40e: check for and deal with non-contiguous TCs
    
    The i40e driver was causing a kernel panic when
    non-contiguous Traffic Classes, or Traffic Classes not
    starting with TC0, were configured on a link partner switch.
    i40e does not support non-contiguous TCs.
    
    To fix this, the patch changes the logic when determining
    the total number of TCs enabled.  Before, this would use the
    highest TC number enabled and assume that all TCs below it were
    also enabled.  Now, we create a bitmask of enabled TCs and scan
    it to determine not only the number of TCs, but also if the set
    of enabled TCs starts at zero and is contiguous.  If not, then
    DCB is disabled by only returning one TC.
    
    Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
    Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

commit 3d951822be216d8c6fcfc8abf75e5ed307eeb646
Author: Alexander Duyck <alexander.h.duyck@intel.com>
Date:   Fri Aug 12 09:53:39 2016 -0700

    ixgbe: Re-enable ability to toggle VLAN filtering
    
    Back when I submitted the GSO code I messed up and dropped the support for
    disabling the VLAN tag filtering via the feature bit.  This patch
    re-enables the use of the NETIF_F_HW_VLAN_CTAG_FILTER to enable/disable the
    VLAN filtering independent of toggling promiscuous mode.
    
    Fixes: b83e30104b ("ixgbe/ixgbevf: Add support for GSO partial")
    Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
    Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

commit f60439bc21e3337429838e477903214f5bd8277f
Author: Alexander Duyck <alexander.h.duyck@intel.com>
Date:   Thu Aug 11 14:51:56 2016 -0700

    ixgbe: Force VLNCTRL.VFE to be set in all VMDq paths
    
    When I was adding the code for enabling VLAN promiscuous mode with SR-IOV
    enabled I had inadvertently left the VLNCTRL.VFE bit unchanged as I has
    assumed there was code in another path that was setting it when we enabled
    SR-IOV.  This wasn't the case and as a result we were just disabling VLAN
    filtering for all the VFs apparently.
    
    Also the previous patches were always clearing CFIEN which was always set
    to 0 by the hardware anyway so I am dropping the redundant bit clearing.
    
    Fixes: 16369564915a ("ixgbe: Add support for VLAN promiscuous with SR-IOV")
    Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
    Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

commit 8037dd60f45264c3fbbea4cc0cea5f2f0a774b5e
Author: Jarod Wilson <jarod@redhat.com>
Date:   Tue Jul 26 14:25:35 2016 -0400

    e1000e: fix PTP on e1000_pch_lpt variants
    
    I've got reports that the Intel I-218V NIC in Intel NUC5i5RYH systems used
    as a PTP slave experiences random ~10 hour clock jumps, which are resolved
    if the same workaround for the 82574 and 82583 is employed, so set the
    appropriate flag2 in e1000_pch_lpt_info too.
    
    Reported-by: Rupesh Patel <rupatel@redhat.com>
    Signed-off-by: Jarod Wilson <jarod@redhat.com>
    Tested-by: Aaron Brown <aaron.f.brown@intel.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

commit 0be5b96cd8400aeb4bf3f8c5e7f5efaa38ae5055
Author: Jarod Wilson <jarod@redhat.com>
Date:   Tue Jul 26 14:25:34 2016 -0400

    e1000e: factor out systim sanitization
    
    This is prepatory work for an expanding list of adapter families that have
    occasional ~10 hour clock jumps when being used for PTP. Factor out the
    sanitization function and convert to using a feature (bug) flag, per
    suggestion from Jesse Brandeburg.
    
    Littering functional code with device-specific checks is much messier than
    simply checking a flag, and having device-specific init set flags as needed.
    There are probably a number of other cases in the e1000e code that
    could/should be converted similarly.
    
    Suggested-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
    Signed-off-by: Jarod Wilson <jarod@redhat.com>
    Tested-by: Aaron Brown <aaron.f.brown@intel.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

commit 0066c8b6f4050d7c57f6379d6fd4535e2f267f17
Author: Kshitiz Gupta <kshitiz.gupta@ni.com>
Date:   Sat Jul 16 02:23:45 2016 -0500

    igb: fix adjusting PTP timestamps for Tx/Rx latency
    
    Fix PHY delay compensation math in igb_ptp_tx_hwtstamp() and
    igb_ptp_rx_rgtstamp. Add PHY delay compensation in
    igb_ptp_rx_pktstamp().
    
    In the IGB driver, there are two functions that retrieve timestamps
    received by the PHY - igb_ptp_rx_rgtstamp() and igb_ptp_rx_pktstamp().
    The previous commit only changed igb_ptp_rx_rgtstamp(), and the change
    was incorrect.
    
    There are two instances in which PHY delay compensations should be
    made:
    
    - Before the packet transmission over the PHY, the latency between
      when the packet is timestamped and transmission of the packets,
      should be an add operation, but it is currently a subtract.
    
    - After the packets are received from the PHY, the latency between
      the receiving and timestamping of the packets should be a subtract
      operation, but it is currently an add.
    
    Signed-off-by: Kshitiz Gupta <kshitiz.gupta@ni.com>
    Fixes: 3f544d2 (igb: adjust ptp timestamps for tx/rx latency)
    Tested-by: Aaron Brown <aaron.f.brown@intel.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

commit 55a4e778191cfcf675aa1f9716edb71a3014d5fb
Author: sean.wang@mediatek.com <sean.wang@mediatek.com>
Date:   Tue Aug 16 13:55:15 2016 +0800

    net: ethernet: mediatek: fix runtime warning raised by inconsistent struct device pointers passed to DMA API
    
    Runtime warning occurs if DMA-API debug feature is enabled that would be
    raised by pointers passed to DMA API as arguments to inconsistent struct
    device objects, so that the patch makes them usage aligned between DMA
    operations such as dma_map_*() and dma_unmap_*() to eliminate the warning.
    
    Signed-off-by: Sean Wang <sean.wang@mediatek.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit b2025c7cc92d5bfc8c5ce756c8d8a6f57c776fbd
Author: sean.wang@mediatek.com <sean.wang@mediatek.com>
Date:   Tue Aug 16 13:55:14 2016 +0800

    net: ethernet: mediatek: fix flow control settings on GMAC0 is not being enabled properly
    
    Commit 08ef55c6f257acf3bdc6940813f80e8f0f5d90ec
    ("net-next: mediatek: fix gigabit and flow control advertisement")
    had supported proper flow control settings for GMAC1. But for GMAC0,
    
    1.GMAC0 shares the common logic with GMAC1 inside mtk_phy_link_adjust()
    to adapt various settings for the target phy.
    
    2.GMAC0 uses fixed-phy to connect to a builtin gigabit switch with
    fixed link speed as commit 0c72c50f6f93b0c3daa9ea35d89ab3a933c7b5a0
    ("net-next: mediatek: add fixed-phy support") describes.
    
    3.However, fixed-phy doesn't enable SUPPORTED_Pause & SUPPORTED_Asym_Pause
    supported flag on default that would cause mtk_phy_link_adjust() not to
    enable flow control setting on GMAC0 properly and cause packet dropped
    when high traffic.
    
    Due to these reasons, the patch adds SUPPORTED_Pause & SUPPORTED_Asym_Pause
    supported flags on fixed-phy used by the driver to have proper handling on
    the both GMAC with the shared common logic.
    
    Signed-off-by: Sean Wang <sean.wang@mediatek.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 8ca7f4fe0733342c862b8585dd6eb6521b9bf533
Author: sean.wang@mediatek.com <sean.wang@mediatek.com>
Date:   Tue Aug 16 13:55:13 2016 +0800

    net: ethernet: mediatek: fix RMII mode and add REVMII supported by GMAC
    
    The patch fixes up the incorrect setup of reduced MII (RMII) on GMAC
    and adds the supplement for the setup of reverse MII (REVMII) on GMAC
    , and rearranges the error handling for invalid PHY argument.
    
    Signed-off-by: Sean Wang <sean.wang@mediatek.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 33e7664a0af6e9a516f01014f39737aaa119b6d9
Author: Wei Yongjun <weiyj.lk@gmail.com>
Date:   Tue Jul 26 14:49:04 2016 +0000

    power_supply: tps65217-charger: fix missing platform_set_drvdata()
    
    Add missing platform_set_drvdata() in tps65217_charger_probe(), otherwise
    calling platform_get_drvdata() in remove returns NULL.
    
    This is detected by Coccinelle semantic patch.
    
    Fixes: 3636859b280c ("power_supply: Add support for tps65217-charger")
    Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
    Signed-off-by: Sebastian Reichel <sre@kernel.org>

commit d2fbdf76b85bcdfe57b8ef2ba09d20e8ada79abd
Author: Vegard Nossum <vegard.nossum@oracle.com>
Date:   Sat Jul 23 08:15:04 2016 +0200

    tipc: fix NULL pointer dereference in shutdown()
    
    tipc_msg_create() can return a NULL skb and if so, we shouldn't try to
    call tipc_node_xmit_skb() on it.
    
        general protection fault: 0000 [#1] PREEMPT SMP KASAN
        CPU: 3 PID: 30298 Comm: trinity-c0 Not tainted 4.7.0-rc7+ #19
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
        task: ffff8800baf09980 ti: ffff8800595b8000 task.ti: ffff8800595b8000
        RIP: 0010:[<ffffffff830bb46b>]  [<ffffffff830bb46b>] tipc_node_xmit_skb+0x6b/0x140
        RSP: 0018:ffff8800595bfce8  EFLAGS: 00010246
        RAX: 0000000000000000 RBX: 0000000000000000 RCX: 000000003023b0e0
        RDX: 0000000000000000 RSI: dffffc0000000000 RDI: ffffffff83d12580
        RBP: ffff8800595bfd78 R08: ffffed000b2b7f32 R09: 0000000000000000
        R10: fffffbfff0759725 R11: 0000000000000000 R12: 1ffff1000b2b7f9f
        R13: ffff8800595bfd58 R14: ffffffff83d12580 R15: dffffc0000000000
        FS:  00007fcdde242700(0000) GS:ffff88011af80000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 00007fcddde1db10 CR3: 000000006874b000 CR4: 00000000000006e0
        DR0: 00007fcdde248000 DR1: 00007fcddd73d000 DR2: 00007fcdde248000
        DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000090602
        Stack:
         0000000000000018 0000000000000018 0000000041b58ab3 ffffffff83954208
         ffffffff830bb400 ffff8800595bfd30 ffffffff8309d767 0000000000000018
         0000000000000018 ffff8800595bfd78 ffffffff8309da1a 00000000810ee611
        Call Trace:
         [<ffffffff830c84a3>] tipc_shutdown+0x553/0x880
         [<ffffffff825b4a3b>] SyS_shutdown+0x14b/0x170
         [<ffffffff8100334c>] do_syscall_64+0x19c/0x410
         [<ffffffff83295ca5>] entry_SYSCALL64_slow_path+0x25/0x25
        Code: 90 00 b4 0b 83 c7 00 f1 f1 f1 f1 4c 8d 6d e0 c7 40 04 00 00 00 f4 c7 40 08 f3 f3 f3 f3 48 89 d8 48 c1 e8 03 c7 45 b4 00 00 00 00 <80> 3c 30 00 75 78 48 8d 7b 08 49 8d 75 c0 48 b8 00 00 00 00 00
        RIP  [<ffffffff830bb46b>] tipc_node_xmit_skb+0x6b/0x140
         RSP <ffff8800595bfce8>
        ---[ end trace 57b0484e351e71f1 ]---
    
    I feel like we should maybe return -ENOMEM or -ENOBUFS, but I'm not sure
    userspace is equipped to handle that. Anyway, this is better than a GPF
    and looks somewhat consistent with other tipc_msg_create() callers.
    
    Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
    Acked-by: Ying Xue <ying.xue@windriver.com>
    Acked-by: Jon Maloy <jon.maloy@ericsson.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 0dbff144a1e7310e2f8b7a957352c4be9aeb38e4
Author: Vitaly Kuznetsov <vkuznets@redhat.com>
Date:   Mon Aug 15 17:48:43 2016 +0200

    hv_netvsc: fix bonding devices check in netvsc_netdev_event()
    
    Bonding driver sets IFF_BONDING on both master (the bonding device) and
    slave (the real NIC) devices and in netvsc_netdev_event() we want to skip
    master devices only. Currently, there is an uncertainty when a slave
    interface is removed: if bonding module comes first in netdev_chain it
    clears IFF_BONDING flag on the netdev and netvsc_netdev_event() correctly
    handles NETDEV_UNREGISTER event, but in case netvsc comes first on the
    chain it sees the device with IFF_BONDING still attached and skips it. As
    we still hold vf_netdev pointer to the device we crash on the next inject.
    
    Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
    Acked-by: Haiyang Zhang <haiyangz@microsoft.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 0f20d795f78d182c4b743d880a5e8dc4d39892fe
Author: Vitaly Kuznetsov <vkuznets@redhat.com>
Date:   Mon Aug 15 17:48:42 2016 +0200

    hv_netvsc: protect module refcount by checking net_device_ctx->vf_netdev
    
    We're not guaranteed to see NETDEV_REGISTER/NETDEV_UNREGISTER notifications
    only once per VF but we increase/decrease module refcount unconditionally.
    Check vf_netdev to make sure we don't take/release it twice. We presume
    that only one VF per netvsc device may exist.
    
    Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
    Acked-by: Haiyang Zhang <haiyangz@microsoft.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 57c1826b991244d2144eb6e3d5d1b13a53cbea63
Author: Vitaly Kuznetsov <vkuznets@redhat.com>
Date:   Mon Aug 15 17:48:41 2016 +0200

    hv_netvsc: reset vf_inject on VF removal
    
    We reset vf_inject on VF going down (netvsc_vf_down()) but we don't on
    VF removal (netvsc_unregister_vf()) so vf_inject stays 'true' while
    vf_netdev is already NULL and we're trying to inject packets into NULL
    net device in netvsc_recv_callback() causing kernel to crash.
    
    Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
    Acked-by: Haiyang Zhang <haiyangz@microsoft.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit d072218f214929194db06069564495b6b9fff34a
Author: Vitaly Kuznetsov <vkuznets@redhat.com>
Date:   Mon Aug 15 17:48:40 2016 +0200

    hv_netvsc: avoid deadlocks between rtnl lock and vf_use_cnt wait
    
    Here is a deadlock scenario:
    - netvsc_vf_up() schedules netvsc_notify_peers() work and quits.
    - netvsc_vf_down() runs before netvsc_notify_peers() gets executed. As it
      is being executed from netdev notifier chain we hold rtnl lock when we
      get here.
    - we enter while (atomic_read(&net_device_ctx->vf_use_cnt) != 0) loop and
      wait till netvsc_notify_peers() drops vf_use_cnt.
    - netvsc_notify_peers() starts on some other CPU but netdev_notify_peers()
      will hang on rtnl_lock().
    - deadlock!
    
    Instead of introducing additional synchronization I suggest we drop
    gwrk.dwrk completely and call NETDEV_NOTIFY_PEERS directly. As we're
    acting under rtnl lock this is legitimate.
    
    Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
    Acked-by: Haiyang Zhang <haiyangz@microsoft.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit f9a7da9130ef0143eb900794c7863dc5c9051fbc
Author: Vitaly Kuznetsov <vkuznets@redhat.com>
Date:   Mon Aug 15 17:48:39 2016 +0200

    hv_netvsc: don't lose VF information
    
    struct netvsc_device is not suitable for storing VF information as this
    structure is being destroyed on MTU change / set channel operation (see
    rndis_filter_device_remove()). Move all VF related stuff to struct
    net_device_context which is persistent.
    
    Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
    Acked-by: Haiyang Zhang <haiyangz@microsoft.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 3d7b33209201cbfa090d614db993571ca3c6b090
Author: Simon Horman <simon.horman@netronome.com>
Date:   Mon Aug 15 13:06:24 2016 +0200

    gre: set inner_protocol on xmit
    
    Ensure that the inner_protocol is set on transmit so that GSO segmentation,
    which relies on that field, works correctly.
    
    This is achieved by setting the inner_protocol in gre_build_header rather
    than each caller of that function. It ensures that the inner_protocol is
    set when gre_fb_xmit() is used to transmit GRE which was not previously the
    case.
    
    I have observed this is not the case when OvS transmits GRE using
    lwtunnel metadata (which it always does).
    
    Fixes: 38720352412a ("gre: Use inner_proto to obtain inner header protocol")
    Cc: Pravin Shelar <pshelar@ovn.org>
    Acked-by: Alexander Duyck <alexander.h.duyck@intel.com>
    Signed-off-by: Simon Horman <simon.horman@netronome.com>
    Acked-by: Pravin B Shelar <pshelar@ovn.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 5e457896986e16c440c97bb94b9ccd95dd157292
Author: Lorenzo Colitti <lorenzo@google.com>
Date:   Sat Aug 13 01:13:38 2016 +0900

    net: ipv6: Fix ping to link-local addresses.
    
    ping_v6_sendmsg does not set flowi6_oif in response to
    sin6_scope_id or sk_bound_dev_if, so it is not possible to use
    these APIs to ping an IPv6 address on a different interface.
    Instead, it sets flowi6_iif, which is incorrect but harmless.
    
    Stop setting flowi6_iif, and support various ways of setting oif
    in the same priority order used by udpv6_sendmsg.
    
    Tested: https://android-review.googlesource.com/#/c/254470/
    Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 12311959ecf8a3a64676c01b62ce67a0c5f0fd49
Author: Vegard Nossum <vegard.nossum@oracle.com>
Date:   Fri Aug 12 20:10:44 2016 +0200

    rhashtable: fix shift by 64 when shrinking
    
    I got this:
    
        ================================================================================
        UBSAN: Undefined behaviour in ./include/linux/log2.h:63:13
        shift exponent 64 is too large for 64-bit type 'long unsigned int'
        CPU: 1 PID: 721 Comm: kworker/1:1 Not tainted 4.8.0-rc1+ #87
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
        Workqueue: events rht_deferred_worker
         0000000000000000 ffff88011661f8d8 ffffffff82344f50 0000000041b58ab3
         ffffffff84f98000 ffffffff82344ea4 ffff88011661f900 ffff88011661f8b0
         0000000000000001 ffff88011661f6b8 dffffc0000000000 ffffffff867f7640
        Call Trace:
         [<ffffffff82344f50>] dump_stack+0xac/0xfc
         [<ffffffff82344ea4>] ? _atomic_dec_and_lock+0xc4/0xc4
         [<ffffffff8242f5b8>] ubsan_epilogue+0xd/0x8a
         [<ffffffff82430c41>] __ubsan_handle_shift_out_of_bounds+0x255/0x29a
         [<ffffffff824309ec>] ? __ubsan_handle_out_of_bounds+0x180/0x180
         [<ffffffff84003436>] ? nl80211_req_set_reg+0x256/0x2f0
         [<ffffffff812112ba>] ? print_context_stack+0x8a/0x160
         [<ffffffff81200031>] ? amd_pmu_reset+0x341/0x380
         [<ffffffff823af808>] rht_deferred_worker+0x1618/0x1790
         [<ffffffff823af808>] ? rht_deferred_worker+0x1618/0x1790
         [<ffffffff823ae1f0>] ? rhashtable_jhash2+0x370/0x370
         [<ffffffff8134c12d>] ? process_one_work+0x6fd/0x1970
         [<ffffffff8134c1cf>] process_one_work+0x79f/0x1970
         [<ffffffff8134c12d>] ? process_one_work+0x6fd/0x1970
         [<ffffffff8134ba30>] ? try_to_grab_pending+0x4c0/0x4c0
         [<ffffffff8134d564>] ? worker_thread+0x1c4/0x1340
         [<ffffffff8134d8ff>] worker_thread+0x55f/0x1340
         [<ffffffff845e904f>] ? __schedule+0x4df/0x1d40
         [<ffffffff8134d3a0>] ? process_one_work+0x1970/0x1970
         [<ffffffff8134d3a0>] ? process_one_work+0x1970/0x1970
         [<ffffffff813642f7>] kthread+0x237/0x390
         [<ffffffff813640c0>] ? __kthread_parkme+0x280/0x280
         [<ffffffff845f8c93>] ? _raw_spin_unlock_irq+0x33/0x50
         [<ffffffff845f95df>] ret_from_fork+0x1f/0x40
         [<ffffffff813640c0>] ? __kthread_parkme+0x280/0x280
        ================================================================================
    
    roundup_pow_of_two() is undefined when called with an argument of 0, so
    let's avoid the call and just fall back to ht->p.min_size (which should
    never be smaller than HASH_MIN_SIZE).
    
    Cc: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
    Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit eb8fc32354aa77678dc6e7950a8f0c79cace204f
Author: Vincent <vincent.stehle@laposte.net>
Date:   Sun Aug 14 15:38:29 2016 +0200

    mlxsw: spectrum_router: Fix use after free
    
    In mlxsw_sp_router_fib4_add_info_destroy(), the fib_entry pointer is used
    after it has been freed by mlxsw_sp_fib_entry_destroy(). Use a temporary
    variable to fix this.
    
    Fixes: 61c503f976b5449e ("mlxsw: spectrum_router: Implement fib4 add/del switchdev obj ops")
    Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
    Cc: Jiri Pirko <jiri@mellanox.com>
    Acked-by: Ido Schimmel <idosch@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 4cf0b354d92ee2c642532ee39e330f8f580fd985
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Aug 12 12:03:52 2016 +0200

    rhashtable: avoid large lock-array allocations
    
    Sander reports following splat after netfilter nat bysrc table got
    converted to rhashtable:
    
    swapper/0: page allocation failure: order:3, mode:0x2084020(GFP_ATOMIC|__GFP_COMP)
     CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc1 [..]
     [<ffffffff811633ed>] warn_alloc_failed+0xdd/0x140
     [<ffffffff811638b1>] __alloc_pages_nodemask+0x3e1/0xcf0
     [<ffffffff811a72ed>] alloc_pages_current+0x8d/0x110
     [<ffffffff8117cb7f>] kmalloc_order+0x1f/0x70
     [<ffffffff811aec19>] __kmalloc+0x129/0x140
     [<ffffffff8146d561>] bucket_table_alloc+0xc1/0x1d0
     [<ffffffff8146da1d>] rhashtable_insert_rehash+0x5d/0xe0
     [<ffffffff819fcfff>] nf_nat_setup_info+0x2ef/0x400
    
    The failure happens when allocating the spinlock array.
    Even with GFP_KERNEL its unlikely for such a large allocation
    to succeed.
    
    Thomas Graf pointed me at inet_ehash_locks_alloc(), so in addition
    to adding NOWARN for atomic allocations this also makes the bucket-array
    sizing more conservative.
    
    In commit 095dc8e0c3686 ("tcp: fix/cleanup inet_ehash_locks_alloc()"),
    Eric Dumazet says: "Budget 2 cache lines per cpu worth of 'spinlocks'".
    IOW, consider size needed by a single spinlock when determining
    number of locks per cpu.  So with 64 byte per cacheline and 4 byte per
    spinlock this gives 32 locks per cpu.
    
    Resulting size of the lock-array (sizeof(spinlock) == 4):
    
    cpus:    1   2   4   8   16   32   64
    old:    1k  1k  4k  8k  16k  16k  16k
    new:   128 256 512  1k   2k   4k   8k
    
    8k allocation should have decent chance of success even
    with GFP_ATOMIC, and should not fail with GFP_KERNEL.
    
    With 72-byte spinlock (LOCKDEP):
    cpus :   1   2
    old:    9k 18k
    new:   ~2k ~4k
    
    Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
    Suggested-by: Thomas Graf <tgraf@suug.ch>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 6be3ffaa0e15c64f560904b025f5c50bef5886f9
Author: Michael S. Tsirkin <mst@redhat.com>
Date:   Mon Aug 15 04:50:55 2016 +0300

    tools/virtio: add dma stubs
    
    Fixes build after recent IOMMU-related changes,
    mustly by adding more stubs.
    
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

commit 446374d7c7f89603d8151b56824e2cac85ed8e0d
Author: Michael S. Tsirkin <mst@redhat.com>
Date:   Mon Aug 15 04:28:12 2016 +0300

    vhost/test: fix after swiotlb changes
    
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

commit 21bc54fc0cdc31de72b57d2b3c79cf9c2b83cf39
Author: Gerard Garcia <ggarcia@deic.uab.cat>
Date:   Wed Aug 10 17:24:34 2016 +0200

    vhost/vsock: drop space available check for TX vq
    
    Remove unnecessary use of enable/disable callback notifications
    and the incorrect more space available check.
    
    The virtio_transport_tx_work handles when the TX virtqueue
    has more buffers available.
    
    Signed-off-by: Gerard Garcia <ggarcia@deic.uab.cat>
    Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

commit 52012619e5a2ca0491426c3712fb9054692d4a3c
Author: Michael S. Tsirkin <mst@redhat.com>
Date:   Sun Aug 14 23:44:21 2016 +0300

    ringtest: test build fix
    
    Recent changes to ptr_ring broke the ringtest
    which lacks a likely() stub. Fix it up.
    
    Fixes: 982fb490c298896d15e9323a882f34a57c11ff56
    	("ptr_ring: support zero length ring")
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

commit 952fcfd08c8109951622579d0ae7b9cd6cafd688
Author: Sabrina Dubroca <sd@queasysnail.net>
Date:   Fri Aug 12 16:10:33 2016 +0200

    net: remove type_check from dev_get_nest_level()
    
    The idea for type_check in dev_get_nest_level() was to count the number
    of nested devices of the same type (currently, only macvlan or vlan
    devices).
    This prevented the false positive lockdep warning on configurations such
    as:
    
    eth0 <--- macvlan0 <--- vlan0 <--- macvlan1
    
    However, this doesn't prevent a warning on a configuration such as:
    
    eth0 <--- macvlan0 <--- vlan0
    eth1 <--- vlan1 <--- macvlan1
    
    In this case, all the locks end up with a nesting subclass of 1, so
    lockdep thinks that there is still a deadlock:
    
    - in the first case we have (macvlan_netdev_addr_lock_key, 1) and then
      take (vlan_netdev_xmit_lock_key, 1)
    - in the second case, we have (vlan_netdev_xmit_lock_key, 1) and then
      take (macvlan_netdev_addr_lock_key, 1)
    
    By removing the linktype check in dev_get_nest_level() and always
    incrementing the nesting depth, lockdep considers this configuration
    valid.
    
    Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit e20038724552cd05e351cd7d7526d646953d26b7
Author: Sabrina Dubroca <sd@queasysnail.net>
Date:   Fri Aug 12 16:10:32 2016 +0200

    macsec: fix lockdep splats when nesting devices
    
    Currently, trying to setup a vlan over a macsec device, or other
    combinations of devices, triggers a lockdep warning.
    
    Use netdev_lockdep_set_classes and ndo_get_lock_subclass, similar to
    what macvlan does.
    
    Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit bc561632dddd5af0c4444d919f01cbf6d553aa0a
Author: Mike Manning <mmanning@brocade.com>
Date:   Fri Aug 12 12:02:38 2016 +0100

    net: ipv6: Do not keep IPv6 addresses when IPv6 is disabled
    
    If IPv6 is disabled when the option is set to keep IPv6
    addresses on link down, userspace is unaware of this as
    there is no such indication via netlink. The solution is to
    remove the IPv6 addresses in this case, which results in
    netlink messages indicating removal of addresses in the
    usual manner. This fix also makes the behavior consistent
    with the case of having IPv6 disabled first, which stops
    IPv6 addresses from being added.
    
    Fixes: f1705ec197e7 ("net: ipv6: Make address flushing on ifdown optional")
    Signed-off-by: Mike Manning <mmanning@brocade.com>
    Acked-by: David Ahern <dsa@cumulusnetworks.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 54236ab09e9696a27baaae693c288920a26e8588
Author: Vegard Nossum <vegard.nossum@oracle.com>
Date:   Fri Aug 12 09:50:51 2016 +0200

    net/sctp: always initialise sctp_ht_iter::start_fail
    
    sctp_transport_seq_start() does not currently clear iter->start_fail on
    success, but relies on it being zero when it is allocated (by
    seq_open_net()).
    
    This can be a problem in the following sequence:
    
        open() // allocates iter (and implicitly sets iter->start_fail = 0)
        read()
         - iter->start() // fails and sets iter->start_fail = 1
         - iter->stop() // doesn't call sctp_transport_walk_stop() (correct)
        read() again
         - iter->start() // succeeds, but doesn't change iter->start_fail
         - iter->stop() // doesn't call sctp_transport_walk_stop() (wrong)
    
    We should initialize sctp_ht_iter::start_fail to zero if ->start()
    succeeds, otherwise it's possible that we leave an old value of 1 there,
    which will cause ->stop() to not call sctp_transport_walk_stop(), which
    causes all sorts of problems like not calling rcu_read_unlock() (and
    preempt_enable()), eventually leading to more warnings like this:
    
        BUG: sleeping function called from invalid context at mm/slab.h:388
        in_atomic(): 0, irqs_disabled(): 0, pid: 16551, name: trinity-c2
        Preemption disabled at:[<ffffffff819bceb6>] rhashtable_walk_start+0x46/0x150
    
         [<ffffffff81149abb>] preempt_count_add+0x1fb/0x280
         [<ffffffff83295892>] _raw_spin_lock+0x12/0x40
         [<ffffffff819bceb6>] rhashtable_walk_start+0x46/0x150
         [<ffffffff82ec665f>] sctp_transport_walk_start+0x2f/0x60
         [<ffffffff82edda1d>] sctp_transport_seq_start+0x4d/0x150
         [<ffffffff81439e50>] traverse+0x170/0x850
         [<ffffffff8143aeec>] seq_read+0x7cc/0x1180
         [<ffffffff814f996c>] proc_reg_read+0xbc/0x180
         [<ffffffff813d0384>] do_loop_readv_writev+0x134/0x210
         [<ffffffff813d2a95>] do_readv_writev+0x565/0x660
         [<ffffffff813d6857>] vfs_readv+0x67/0xa0
         [<ffffffff813d6c16>] do_preadv+0x126/0x170
         [<ffffffff813d710c>] SyS_preadv+0xc/0x10
         [<ffffffff8100334c>] do_syscall_64+0x19c/0x410
         [<ffffffff83296225>] return_from_SYSCALL_64+0x0/0x6a
         [<ffffffffffffffff>] 0xffffffffffffffff
    
    Notice that this is a subtly different stacktrace from the one in commit
    5fc382d875 ("net/sctp: terminate rhashtable walk correctly").
    
    Cc: Xin Long <lucien.xin@gmail.com>
    Cc: Herbert Xu <herbert@gondor.apana.org.au>
    Cc: Eric W. Biederman <ebiederm@xmission.com>
    Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
    Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
    Acked-By: Neil Horman <nhorman@tuxdriver.com>
    Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 5ba092efc7ddff040777ae7162f1d195f513571b
Author: Vegard Nossum <vegard.nossum@oracle.com>
Date:   Fri Aug 12 10:29:13 2016 +0200

    net/irda: handle iriap_register_lsap() allocation failure
    
    If iriap_register_lsap() fails to allocate memory, self->lsap is
    set to NULL. However, none of the callers handle the failure and
    irlmp_connect_request() will happily dereference it:
    
        iriap_register_lsap: Unable to allocated LSAP!
        ================================================================================
        UBSAN: Undefined behaviour in net/irda/irlmp.c:378:2
        member access within null pointer of type 'struct lsap_cb'
        CPU: 1 PID: 15403 Comm: trinity-c0 Not tainted 4.8.0-rc1+ #81
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org
        04/01/2014
         0000000000000000 ffff88010c7e78a8 ffffffff82344f40 0000000041b58ab3
         ffffffff84f98000 ffffffff82344e94 ffff88010c7e78d0 ffff88010c7e7880
         ffff88010630ad00 ffffffff84a5fae0 ffffffff84d3f5c0 000000000000017a
        Call Trace:
         [<ffffffff82344f40>] dump_stack+0xac/0xfc
         [<ffffffff8242f5a8>] ubsan_epilogue+0xd/0x8a
         [<ffffffff824302bf>] __ubsan_handle_type_mismatch+0x157/0x411
         [<ffffffff83b7bdbc>] irlmp_connect_request+0x7ac/0x970
         [<ffffffff83b77cc0>] iriap_connect_request+0xa0/0x160
         [<ffffffff83b77f48>] state_s_disconnect+0x88/0xd0
         [<ffffffff83b78904>] iriap_do_client_event+0x94/0x120
         [<ffffffff83b77710>] iriap_getvaluebyclass_request+0x3e0/0x6d0
         [<ffffffff83ba6ebb>] irda_find_lsap_sel+0x1eb/0x630
         [<ffffffff83ba90c8>] irda_connect+0x828/0x12d0
         [<ffffffff833c0dfb>] SYSC_connect+0x22b/0x340
         [<ffffffff833c7e09>] SyS_connect+0x9/0x10
         [<ffffffff81007bd3>] do_syscall_64+0x1b3/0x4b0
         [<ffffffff845f946a>] entry_SYSCALL64_slow_path+0x25/0x25
        ================================================================================
    
    The bug seems to have been around since forever.
    
    There's more problems with missing error checks in iriap_init() (and
    indeed all of irda_init()), but that's a bigger problem that needs
    very careful review and testing. This patch will fix the most serious
    bug (as it's easily reached from unprivileged userspace).
    
    I have tested my patch with a reproducer.
    
    Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit c15c0ab12fd62f2b19181d05c62d24bc9fa55a42
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Fri Aug 12 07:48:21 2016 +0200

    ipv6: suppress sparse warnings in IP6_ECN_set_ce()
    
    Pass the correct type __wsum to csum_sub() and csum_add(). This doesn't
    really change anything since __wsum really *is* __be32, but removes the
    address space warnings from sparse.
    
    Cc: Eric Dumazet <edumazet@google.com>
    Fixes: 34ae6a1aa054 ("ipv6: update skb->csum when CE mark is propagated")
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Acked-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 0ed661d5a48fa6df0b50ae64d27fe759a3ce42cf
Author: Daniel Borkmann <daniel@iogearbox.net>
Date:   Thu Aug 11 21:38:37 2016 +0200

    bpf: fix write helpers with regards to non-linear parts
    
    Fix the bpf_try_make_writable() helper and all call sites we have in BPF,
    it's currently defect with regards to skbs when the write_len spans into
    non-linear parts, no matter if cloned or not.
    
    There are multiple issues at once. First, using skb_store_bits() is not
    correct since even if we have a cloned skb, page frags can still be shared.
    To really make them private, we need to pull them in via __pskb_pull_tail()
    first, which also gets us a private head via pskb_expand_head() implicitly.
    
    This is for helpers like bpf_skb_store_bytes(), bpf_l3_csum_replace(),
    bpf_l4_csum_replace(). Really, the only thing reasonable and working here
    is to call skb_ensure_writable() before any write operation. Meaning, via
    pskb_may_pull() it makes sure that parts we want to access are pulled in and
    if not does so plus unclones the skb implicitly. If our write_len still fits
    the headlen and we're cloned and our header of the clone is not writable,
    then we need to make a private copy via pskb_expand_head(). skb_store_bits()
    is a bit misleading and only safe to store into non-linear data in different
    contexts such as 357b40a18b04 ("[IPV6]: IPV6_CHECKSUM socket option can
    corrupt kernel memory").
    
    For above BPF helper functions, it means after fixed bpf_try_make_writable(),
    we've pulled in enough, so that we operate always based on skb->data. Thus,
    the call to skb_header_pointer() and skb_store_bits() becomes superfluous.
    In bpf_skb_store_bytes(), the len check is unnecessary too since it can
    only pass in maximum of BPF stack size, so adding offset is guaranteed to
    never overflow. Also bpf_l3/4_csum_replace() helpers must test for proper
    offset alignment since they use __sum16 pointer for writing resulting csum.
    
    The remaining helpers that change skb data not discussed here yet are
    bpf_skb_vlan_push(), bpf_skb_vlan_pop() and bpf_skb_change_proto(). The
    vlan helpers internally call either skb_ensure_writable() (pop case) and
    skb_cow_head() (push case, for head expansion), respectively. Similarly,
    bpf_skb_proto_xlat() takes care to not mangle page frags.
    
    Fixes: 608cd71a9c7c ("tc: bpf: generalize pedit action")
    Fixes: 91bc4822c3d6 ("tc: bpf: add checksum helpers")
    Fixes: 3697649ff29e ("bpf: try harder on clones when writing into skb")
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Acked-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit e8c2993a4c9fdb0c9e6fc983edd5b52716ce7442
Author: sean.wang@mediatek.com <sean.wang@mediatek.com>
Date:   Sat Aug 13 19:16:19 2016 +0800

    net: ethernet: mediatek: add the missing of_node_put() after node is used done
    
    This patch adds the missing of_node_put() after finishing the usage
    of of_parse_phandle() or of_node_get() used by fixed_phy.
    
    Signed-off-by: Sean Wang <sean.wang@mediatek.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit d7005652cd31dfc5660e1e32bf7e53538ef14987
Author: sean.wang@mediatek.com <sean.wang@mediatek.com>
Date:   Sat Aug 13 19:16:18 2016 +0800

    net: ethernet: mediatek: fixed that initializing u64_stats_sync is missing
    
    To fix runtime warning with lockdep is enabled due that u64_stats_sync
    is not initialized well, so add it.
    
    Signed-off-by: Sean Wang <sean.wang@mediatek.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit b4c0e0c61f81dedc82dda35c287ea149ff98b434
Author: Colin Ian King <colin.king@canonical.com>
Date:   Thu Aug 11 18:17:22 2016 +0100

    calipso: fix resource leak on calipso_genopt failure
    
    Currently, if calipso_genopt fails then the error exit path
    does not free the ipv6_opt_hdr new causing a memory leak. Fix
    this by kfree'ing new on the error exit path.
    
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 747ea55e4f78fd980350c39570a986b8c1c3e4aa
Author: Daniel Borkmann <daniel@iogearbox.net>
Date:   Fri Aug 12 22:17:17 2016 +0200

    bpf: fix bpf_skb_in_cgroup helper naming
    
    While hashing out BPF's current_task_under_cgroup helper bits, it came
    to discussion that the skb_in_cgroup helper name was suboptimally chosen.
    
    Tejun says:
    
      So, I think in_cgroup should mean that the object is in that
      particular cgroup while under_cgroup in the subhierarchy of that
      cgroup. Let's rename the other subhierarchy test to under too. I
      think that'd be a lot less confusing going forward.
    
      [...]
    
      It's more intuitive and gives us the room to implement the real
      "in" test if ever necessary in the future.
    
    Since this touches uapi bits, we need to change this as long as v4.8
    is not yet officially released. Thus, change the helper enum and rename
    related bits.
    
    Fixes: 4a482f34afcc ("cgroup: bpf: Add bpf_skb_in_cgroup_proto")
    Reference: http://patchwork.ozlabs.org/patch/658500/
    Suggested-by: Sargun Dhillon <sargun@sargun.me>
    Suggested-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Acked-by: Alexei Starovoitov <ast@kernel.org>

commit 601bbae0bc10d4306857b93d84240b039b3d9a6c
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Wed Aug 10 23:54:08 2016 +0200

    dsa: mv88e6xxx: hide unused functions
    
    When CONFIG_NET_DSA_HWMON is disabled, we get warnings about two unused
    functions whose only callers are all inside of an #ifdef:
    
    drivers/net/dsa/mv88e6xxx.c:3257:12: 'mv88e6xxx_mdio_page_write' defined but not used [-Werror=unused-function]
    drivers/net/dsa/mv88e6xxx.c:3244:12: 'mv88e6xxx_mdio_page_read' defined but not used [-Werror=unused-function]
    
    This adds another ifdef around the function definitions. The warnings
    appeared after the functions were marked 'static', but the problem
    was already there before that.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Fixes: 57d3231057e9 ("net: dsa: mv88e6xxx: fix style issues")
    Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit bae170efd6c42bf116f513a1dd07639d68fa71b9
Author: Arvind Yadav <arvind.yadav.cs@gmail.com>
Date:   Fri Aug 12 20:49:18 2016 +0530

    power: reset: hisi-reboot: Unmap region obtained by of_iomap
    
    Free memory mapping, if probe is not successful.
    
    Fixes: 4a9b37371822 ("power: reset: move hisilicon reboot code")
    Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
    Signed-off-by: Sebastian Reichel <sre@kernel.org>

commit 7a4947cf6f26b7d0a5db260d212f6df41a563d23
Author: Andy Yan <andy.yan@rock-chips.com>
Date:   Fri Aug 12 18:01:50 2016 +0800

    power: reset: reboot-mode: fix build error of missing ioremap/iounmap on UM
    
    commit 4fcd504edbf7 ("power: reset: add reboot mode driver") uses api from
    syscon, and syscon uses ioremap/iounmap which depends on HAS_IOMEM, so
    let's depend on MFD_SYSCON instead of selecting it directly to avoid the
    um-allyesconfig like build error on archs that without iomem:
    
    drivers/mfd/syscon.c: In function 'of_syscon_register':
    drivers/mfd/syscon.c:67:9: error: implicit declaration of function 'ioremap' [-Werror=implicit-function-declaration]
      base = ioremap(res.start, resource_size(&res));
             ^
    drivers/mfd/syscon.c:67:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      base = ioremap(res.start, resource_size(&res));
           ^
    drivers/mfd/syscon.c:109:2: error: implicit declaration of function 'iounmap' [-Werror=implicit-function-declaration]
      iounmap(base);
      ^
    
    Reported-by: Kbuild test robot <fengguang.wu@intel.com>
    Fixes: 4fcd504edbf7("power: reset: add reboot mode driver")
    Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
    Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
    Signed-off-by: Sebastian Reichel <sre@kernel.org>

commit 5381cfb6f0422da24cfa9da35b0433c0415830e0
Author: Sven Van Asbroeck <thesven73@gmail.com>
Date:   Fri Aug 12 09:10:27 2016 -0400

    power: supply: max17042_battery: fix model download bug.
    
    The device's model download function returns the model data as
    an array of u32s, which is later compared to the reference
    model data. However, since the latter is an array of u16s,
    the comparison does not happen correctly, and model verification
    fails. This in turn breaks the POR initialization sequence.
    
    Fixes: 39e7213edc4f3 ("max17042_battery: Support regmap to access device's registers")
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Sven Van Asbroeck <TheSven73@googlemail.com>
    Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
    Signed-off-by: Sebastian Reichel <sre@kernel.org>

commit bbe11fab0b6c1d113776b2898e085bf4d1fdc607
Author: Sabrina Dubroca <sd@queasysnail.net>
Date:   Thu Aug 11 15:24:27 2016 +0200

    macsec: use after free when deleting the underlying device
    
    macsec_notify() loops over the list of macsec devices configured on the
    underlying device when this device is being removed.  This list is part
    of the rx_handler data.
    
    However, macsec_dellink unregisters the rx_handler and frees the
    rx_handler data when the last macsec device is removed from the
    underlying device.
    
    Add macsec_common_dellink() to delete macsec devices without
    unregistering the rx_handler and freeing the associated data.
    
    Fixes: 960d5848dbf1 ("macsec: fix memory leaks around rx_handler (un)registration")
    Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 104a493390940e85fb7c840a9fd5214aba5cb3bd
Author: Jason Wang <jasowang@redhat.com>
Date:   Thu Aug 11 18:15:56 2016 +0800

    macvtap: fix use after free for skb_array during release
    
    We've clean skb_array in macvtap_put_queue() but still try to pop from
    it during macvtap_sock_destruct(). Fix this use after free by moving
    the skb array cleanup to macvtap_sock_destruct() instead.
    
    Fixes: 362899b8725b ("macvtap: switch to use skb array")
    Reported-by: Cornelia Huck <cornelia.huck@de.ibm.com>
    Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit af7752106e4f12b4ee47b4eca3e7ba4bcec6e7e5
Author: Stefan Haberland <sth@linux.vnet.ibm.com>
Date:   Tue Aug 9 15:58:48 2016 +0200

    s390/dasd: fix failing CUIR assignment under LPAR
    
    On LPAR the read message buffer command should be executed on the path
    it was received on otherwise there is a chance that the CUIR assignment
    might be faulty and the wrong channel path is set online/offline.
    
    Fix by setting the path mask accordingly.
    On z/VM we might not be able to do I/O on this path but there it does
    not matter on which path the read message buffer command is executed.
    Therefor implement a retry with an open path mask.
    
    Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>

commit 4b5b9ba553f9aa5f484ab972fc9b58061885ceca
Author: Martynas Pumputis <martynas@weave.works>
Date:   Tue Aug 9 16:24:50 2016 +0100

    openvswitch: do not ignore netdev errors when creating tunnel vports
    
    The creation of a tunnel vport (geneve, gre, vxlan) brings up a
    corresponding netdev, a multi-step operation which can fail.
    
    For example, changing a vxlan vport's netdev state to 'up' binds the
    vport's socket to a UDP port - if the binding fails (e.g. due to the
    port being in use), the error is currently ignored giving the
    appearance that the tunnel vport creation completed successfully.
    
    Signed-off-by: Martynas Pumputis <martynas@weave.works>
    Acked-by: Pravin B Shelar <pshelar@ovn.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit dafa6b0db2d62164c5ef81a40312d5ba514126b9
Author: Fabian Frederick <fabf@skynet.be>
Date:   Wed Aug 10 17:48:36 2016 +0200

    net: hns: fix typo in g_gmac_stats_string[]
    
    s/gamc/gmac/
    
    Signed-off-by: Fabian Frederick <fabf@skynet.be>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit 672ca65d9aa8578f382784fe73578cd499664828
Author: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Date:   Wed Aug 10 14:07:34 2016 +0200

    tipc: fix variable dereference before NULL check
    
    In commit cf6f7e1d5109 ("tipc: dump monitor attributes"),
    I dereferenced a pointer before checking if its valid.
    This is reported by static check Smatch as:
    net/tipc/monitor.c:733 tipc_nl_add_monitor_peer()
         warn: variable dereferenced before check 'mon' (see line 731)
    
    In this commit, we check for a valid monitor before proceeding
    with any other operation.
    
    Fixes: cf6f7e1d5109 ("tipc: dump monitor attributes")
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

commit e95d0dfb229fffe96dc4c29054f6c7a7302e111e
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Tue Aug 2 18:18:33 2016 +0300

    pinctrl: intel: merrifield: Add missed header
    
    On x86 builds the absense of <linux/io.h> makes static analyzer and compiler
    unhappy which fails to build the driver.
    
    CHECK   drivers/pinctrl/intel/pinctrl-merrifield.c
    drivers/pinctrl/intel/pinctrl-merrifield.c:518:17:
      error: undefined identifier 'readl'
    drivers/pinctrl/intel/pinctrl-merrifield.c:570:17:
      error: undefined identifier 'readl'
    drivers/pinctrl/intel/pinctrl-merrifield.c:575:9:
      error: undefined identifier 'writel'
    drivers/pinctrl/intel/pinctrl-merrifield.c:645:17:
      error: undefined identifier 'readl'
      CC      drivers/pinctrl/intel/pinctrl-merrifield.o
    drivers/pinctrl/intel/pinctrl-merrifield.c: In function ‘mrfld_pin_dbg_show’:
    drivers/pinctrl/intel/pinctrl-merrifield.c:518:10:
      error: implicit declaration of function ‘readl’
      [-Werror=implicit-function-declaration]
      value = readl(bufcfg);
                ^
    drivers/pinctrl/intel/pinctrl-merrifield.c: In function ‘mrfld_update_bufcfg’:
    drivers/pinctrl/intel/pinctrl-merrifield.c:575:2:
      error: implicit declaration of function ‘writel’
      [-Werror=implicit-function-declaration]
      writel(value, bufcfg);
        ^
    cc1: some warnings being treated as errors
    
    Add header to the top of the module.
    
    Fixes: 4e80c8f50574 ("pinctrl: intel: Add Intel Merrifield pin controller support")
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

commit 8cf4345575a416e6856a6856ac6eaa31ad883126
Author: Agrawal, Nitesh-kumar <Nitesh-kumar.Agrawal@amd.com>
Date:   Tue Jul 26 08:28:19 2016 +0000

    pinctrl/amd: Remove the default de-bounce time
    
    In the function amd_gpio_irq_enable() and
    amd_gpio_direction_input(), remove the code which is setting
    the default de-bounce time to 2.75ms.
    
    The driver code shall use the same settings as specified in
    BIOS. Any default assignment impacts TouchPad behaviour when
    the LevelTrig is set to EDGE FALLING.
    
    Cc: stable@vger.kernel.org
    Reviewed-by:  Ken Xue <Ken.Xue@amd.com>
    Signed-off-by: Nitesh Kumar Agrawal <Nitesh-kumar.Agrawal@amd.com>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

commit b120a3c286520ca465c54e8afa442be10560053b
Author: Wei Yongjun <weiyj.lk@gmail.com>
Date:   Tue Jul 26 14:52:57 2016 +0000

    pinctrl: pistachio: Drop pinctrl_unregister for devm_ registered device
    
    It's not necessary to unregister pin controller device registered
    with devm_pinctrl_register() and using pinctrl_unregister() leads
    to a double free.
    
    This is detected by Coccinelle semantic patch.
    
    Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

commit 5b236d0fde21d88351420ef0b9a6cb7aeeea0c54
Author: Wei Yongjun <weiyj.lk@gmail.com>
Date:   Tue Jul 26 14:51:58 2016 +0000

    pinctrl: meson: Drop pinctrl_unregister for devm_ registered device
    
    It's not necessary to unregister pin controller device registered
    with devm_pinctrl_register() and using pinctrl_unregister() leads
    to a double free.
    
    This is detected by Coccinelle semantic patch.
    
    Fixes: e649f7ec8c5f ("pinctrl: meson: Use devm_pinctrl_register() for pinctrl registration")
    Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
    Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Acked-by: Kevin Hilman <khilman@baylibre.com>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

commit 4da449ae1df9cfeb167e78f250b250eff64bc65e
Author: Laura Garcia Liebana <nevola@gmail.com>
Date:   Tue Aug 9 20:46:16 2016 +0200

    netfilter: nft_exthdr: Add size check on u8 nft_exthdr attributes
    
    Fix the direct assignment of offset and length attributes included in
    nft_exthdr structure from u32 data to u8.
    
    Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

commit c987ff0d3cb37d7fe1ddaa370811dfd9f73643fa
Author: Robin Murphy <robin.murphy@arm.com>
Date:   Tue Aug 9 17:31:35 2016 +0100

    iommu/dma: Respect IOMMU aperture when allocating
    
    Where a device driver has set a 64-bit DMA mask to indicate the absence
    of addressing limitations, we still need to ensure that we don't
    allocate IOVAs beyond the actual input size of the IOMMU. The reported
    aperture is the most reliable way we have of inferring that input
    address size, so use that to enforce a hard upper limit where available.
    
    Fixes: 0db2e5d18f76 ("iommu: Implem…
  • Loading branch information
mmotm auto import authored and hnaz committed Aug 19, 2016
1 parent 694d0d0 commit 9d5cf2b
Show file tree
Hide file tree
Showing 154 changed files with 1,712 additions and 1,273 deletions.
21 changes: 11 additions & 10 deletions Documentation/networking/rxrpc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -790,13 +790,12 @@ The kernel interface functions are as follows:
Data messages can have their contents extracted with the usual bunch of
socket buffer manipulation functions. A data message can be determined to
be the last one in a sequence with rxrpc_kernel_is_data_last(). When a
data message has been used up, rxrpc_kernel_data_delivered() should be
called on it..
data message has been used up, rxrpc_kernel_data_consumed() should be
called on it.

Non-data messages should be handled to rxrpc_kernel_free_skb() to dispose
of. It is possible to get extra refs on all types of message for later
freeing, but this may pin the state of a call until the message is finally
freed.
Messages should be handled to rxrpc_kernel_free_skb() to dispose of. It
is possible to get extra refs on all types of message for later freeing,
but this may pin the state of a call until the message is finally freed.

(*) Accept an incoming call.

Expand All @@ -821,12 +820,14 @@ The kernel interface functions are as follows:
Other errors may be returned if the call had been aborted (-ECONNABORTED)
or had timed out (-ETIME).

(*) Record the delivery of a data message and free it.
(*) Record the delivery of a data message.

void rxrpc_kernel_data_delivered(struct sk_buff *skb);
void rxrpc_kernel_data_consumed(struct rxrpc_call *call,
struct sk_buff *skb);

This is used to record a data message as having been delivered and to
update the ACK state for the call. The socket buffer will be freed.
This is used to record a data message as having been consumed and to
update the ACK state for the call. The message must still be passed to
rxrpc_kernel_free_skb() for disposal by the caller.

(*) Free a message.

Expand Down
11 changes: 8 additions & 3 deletions arch/s390/boot/compressed/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,21 @@ ENTRY(startup_continue)
lg %r15,.Lstack-.LPG1(%r13)
aghi %r15,-160
brasl %r14,decompress_kernel
# setup registers for memory mover & branch to target
# Set up registers for memory mover. We move the decompressed image to
# 0x11000, starting at offset 0x11000 in the decompressed image so
# that code living at 0x11000 in the image will end up at 0x11000 in
# memory.
lgr %r4,%r2
lg %r2,.Loffset-.LPG1(%r13)
la %r4,0(%r2,%r4)
lg %r3,.Lmvsize-.LPG1(%r13)
lgr %r5,%r3
# move the memory mover someplace safe
# Move the memory mover someplace safe so it doesn't overwrite itself.
la %r1,0x200
mvc 0(mover_end-mover,%r1),mover-.LPG1(%r13)
# decompress image is started at 0x11000
# When the memory mover is done we pass control to
# arch/s390/kernel/head64.S:startup_continue which lives at 0x11000 in
# the decompressed image.
lgr %r6,%r2
br %r1
mover:
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/configs/default_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ CONFIG_CRYPTO_SHA512_S390=m
CONFIG_CRYPTO_DES_S390=m
CONFIG_CRYPTO_AES_S390=m
CONFIG_CRYPTO_GHASH_S390=m
CONFIG_CRYPTO_CRC32_S390=m
CONFIG_CRYPTO_CRC32_S390=y
CONFIG_ASYMMETRIC_KEY_TYPE=y
CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m
CONFIG_X509_CERTIFICATE_PARSER=m
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/configs/gcov_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ CONFIG_CRYPTO_SHA512_S390=m
CONFIG_CRYPTO_DES_S390=m
CONFIG_CRYPTO_AES_S390=m
CONFIG_CRYPTO_GHASH_S390=m
CONFIG_CRYPTO_CRC32_S390=m
CONFIG_CRYPTO_CRC32_S390=y
CONFIG_ASYMMETRIC_KEY_TYPE=y
CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m
CONFIG_X509_CERTIFICATE_PARSER=m
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/configs/performance_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ CONFIG_CRYPTO_SHA512_S390=m
CONFIG_CRYPTO_DES_S390=m
CONFIG_CRYPTO_AES_S390=m
CONFIG_CRYPTO_GHASH_S390=m
CONFIG_CRYPTO_CRC32_S390=m
CONFIG_CRYPTO_CRC32_S390=y
CONFIG_ASYMMETRIC_KEY_TYPE=y
CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m
CONFIG_X509_CERTIFICATE_PARSER=m
Expand Down
6 changes: 3 additions & 3 deletions arch/s390/crypto/crc32-vx.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ u32 crc32c_le_vgfm_16(u32 crc, unsigned char const *buf, size_t size);
struct kernel_fpu vxstate; \
unsigned long prealign, aligned, remaining; \
\
if (datalen < VX_MIN_LEN + VX_ALIGN_MASK) \
return ___crc32_sw(crc, data, datalen); \
\
if ((unsigned long)data & VX_ALIGN_MASK) { \
prealign = VX_ALIGNMENT - \
((unsigned long)data & VX_ALIGN_MASK); \
Expand All @@ -59,9 +62,6 @@ u32 crc32c_le_vgfm_16(u32 crc, unsigned char const *buf, size_t size);
data = (void *)((unsigned long)data + prealign); \
} \
\
if (datalen < VX_MIN_LEN) \
return ___crc32_sw(crc, data, datalen); \
\
aligned = datalen & ~VX_ALIGN_MASK; \
remaining = datalen & VX_ALIGN_MASK; \
\
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ CONFIG_CRYPTO_SHA256_S390=m
CONFIG_CRYPTO_SHA512_S390=m
CONFIG_CRYPTO_DES_S390=m
CONFIG_CRYPTO_AES_S390=m
CONFIG_CRYPTO_CRC32_S390=m
CONFIG_CRYPTO_CRC32_S390=y
CONFIG_CRC7=m
# CONFIG_XZ_DEC_X86 is not set
# CONFIG_XZ_DEC_POWERPC is not set
Expand Down
4 changes: 3 additions & 1 deletion arch/s390/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ ENTRY(startup_kdump)
l %r15,.Lstack-.LPG0(%r13)
ahi %r15,-STACK_FRAME_OVERHEAD
brasl %r14,verify_facilities
/* Continue with startup code in head64.S */
# For uncompressed images, continue in
# arch/s390/kernel/head64.S. For compressed images, continue in
# arch/s390/boot/compressed/head.S.
jg startup_continue

.Lstack:
Expand Down
16 changes: 7 additions & 9 deletions arch/s390/lib/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,10 @@ char * strrchr(const char * s, int c)
EXPORT_SYMBOL(strrchr);

static inline int clcle(const char *s1, unsigned long l1,
const char *s2, unsigned long l2,
int *diff)
const char *s2, unsigned long l2)
{
register unsigned long r2 asm("2") = (unsigned long) s1;
register unsigned long r3 asm("3") = (unsigned long) l2;
register unsigned long r3 asm("3") = (unsigned long) l1;
register unsigned long r4 asm("4") = (unsigned long) s2;
register unsigned long r5 asm("5") = (unsigned long) l2;
int cc;
Expand All @@ -252,7 +251,6 @@ static inline int clcle(const char *s1, unsigned long l1,
" srl %0,28"
: "=&d" (cc), "+a" (r2), "+a" (r3),
"+a" (r4), "+a" (r5) : : "cc");
*diff = *(char *)r2 - *(char *)r4;
return cc;
}

Expand All @@ -270,9 +268,9 @@ char * strstr(const char * s1,const char * s2)
return (char *) s1;
l1 = __strend(s1) - s1;
while (l1-- >= l2) {
int cc, dummy;
int cc;

cc = clcle(s1, l1, s2, l2, &dummy);
cc = clcle(s1, l2, s2, l2);
if (!cc)
return (char *) s1;
s1++;
Expand Down Expand Up @@ -313,11 +311,11 @@ EXPORT_SYMBOL(memchr);
*/
int memcmp(const void *cs, const void *ct, size_t n)
{
int ret, diff;
int ret;

ret = clcle(cs, n, ct, n, &diff);
ret = clcle(cs, n, ct, n);
if (ret)
ret = diff;
ret = ret == 1 ? -1 : 1;
return ret;
}
EXPORT_SYMBOL(memcmp);
Expand Down
2 changes: 2 additions & 0 deletions arch/s390/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ static int change_page_attr(unsigned long addr, unsigned long end,
int rc = -EINVAL;
pgd_t *pgdp;

if (addr == end)
return 0;
if (end >= MODULES_END)
return -EINVAL;
mutex_lock(&cpa_mutex);
Expand Down
2 changes: 1 addition & 1 deletion crypto/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ config CRYPTO_CRC32C_INTEL

config CRYPT_CRC32C_VPMSUM
tristate "CRC32c CRC algorithm (powerpc64)"
depends on PPC64
depends on PPC64 && ALTIVEC
select CRYPTO_HASH
select CRC32
help
Expand Down
16 changes: 8 additions & 8 deletions crypto/sha3_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
#define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y))))

static const u64 keccakf_rndc[24] = {
0x0000000000000001, 0x0000000000008082, 0x800000000000808a,
0x8000000080008000, 0x000000000000808b, 0x0000000080000001,
0x8000000080008081, 0x8000000000008009, 0x000000000000008a,
0x0000000000000088, 0x0000000080008009, 0x000000008000000a,
0x000000008000808b, 0x800000000000008b, 0x8000000000008089,
0x8000000000008003, 0x8000000000008002, 0x8000000000000080,
0x000000000000800a, 0x800000008000000a, 0x8000000080008081,
0x8000000000008080, 0x0000000080000001, 0x8000000080008008
0x0000000000000001ULL, 0x0000000000008082ULL, 0x800000000000808aULL,
0x8000000080008000ULL, 0x000000000000808bULL, 0x0000000080000001ULL,
0x8000000080008081ULL, 0x8000000000008009ULL, 0x000000000000008aULL,
0x0000000000000088ULL, 0x0000000080008009ULL, 0x000000008000000aULL,
0x000000008000808bULL, 0x800000000000008bULL, 0x8000000000008089ULL,
0x8000000000008003ULL, 0x8000000000008002ULL, 0x8000000000000080ULL,
0x000000000000800aULL, 0x800000008000000aULL, 0x8000000080008081ULL,
0x8000000000008080ULL, 0x0000000080000001ULL, 0x8000000080008008ULL
};

static const int keccakf_rotc[24] = {
Expand Down
13 changes: 8 additions & 5 deletions drivers/crypto/caam/caamalg.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ static int aead_set_sh_desc(struct crypto_aead *aead)
OP_ALG_AAI_CTR_MOD128);
const bool is_rfc3686 = alg->caam.rfc3686;

if (!ctx->authsize)
return 0;

/* NULL encryption / decryption */
if (!ctx->enckeylen)
return aead_null_set_sh_desc(aead);
Expand Down Expand Up @@ -614,7 +617,7 @@ static int aead_set_sh_desc(struct crypto_aead *aead)
keys_fit_inline = true;

/* aead_givencrypt shared descriptor */
desc = ctx->sh_desc_givenc;
desc = ctx->sh_desc_enc;

/* Note: Context registers are saved. */
init_sh_desc_key_aead(desc, ctx, keys_fit_inline, is_rfc3686);
Expand Down Expand Up @@ -645,13 +648,13 @@ static int aead_set_sh_desc(struct crypto_aead *aead)
append_operation(desc, ctx->class2_alg_type |
OP_ALG_AS_INITFINAL | OP_ALG_ENCRYPT);

/* ivsize + cryptlen = seqoutlen - authsize */
append_math_sub_imm_u32(desc, REG3, SEQOUTLEN, IMM, ctx->authsize);

/* Read and write assoclen bytes */
append_math_add(desc, VARSEQINLEN, ZERO, REG3, CAAM_CMD_SZ);
append_math_add(desc, VARSEQOUTLEN, ZERO, REG3, CAAM_CMD_SZ);

/* ivsize + cryptlen = seqoutlen - authsize */
append_math_sub_imm_u32(desc, REG3, SEQOUTLEN, IMM, ctx->authsize);

/* Skip assoc data */
append_seq_fifo_store(desc, 0, FIFOST_TYPE_SKIP | FIFOLDST_VLF);

Expand Down Expand Up @@ -697,7 +700,7 @@ static int aead_set_sh_desc(struct crypto_aead *aead)
ctx->sh_desc_enc_dma = dma_map_single(jrdev, desc,
desc_bytes(desc),
DMA_TO_DEVICE);
if (dma_mapping_error(jrdev, ctx->sh_desc_givenc_dma)) {
if (dma_mapping_error(jrdev, ctx->sh_desc_enc_dma)) {
dev_err(jrdev, "unable to map shared descriptor\n");
return -ENOMEM;
}
Expand Down
1 change: 1 addition & 0 deletions drivers/crypto/caam/caamhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,7 @@ caam_hash_alloc(struct caam_hash_template *template,
template->name);
snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
template->driver_name);
t_alg->ahash_alg.setkey = NULL;
}
alg->cra_module = THIS_MODULE;
alg->cra_init = caam_hash_cra_init;
Expand Down
15 changes: 11 additions & 4 deletions drivers/edac/sb_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,9 @@ static const struct pci_id_table pci_dev_descr_haswell_table[] = {
/* Knight's Landing Support */
/*
* KNL's memory channels are swizzled between memory controllers.
* MC0 is mapped to CH3,5,6 and MC1 is mapped to CH0,1,2
* MC0 is mapped to CH3,4,5 and MC1 is mapped to CH0,1,2
*/
#define knl_channel_remap(channel) ((channel + 3) % 6)
#define knl_channel_remap(mc, chan) ((mc) ? (chan) : (chan) + 3)

/* Memory controller, TAD tables, error injection - 2-8-0, 2-9-0 (2 of these) */
#define PCI_DEVICE_ID_INTEL_KNL_IMC_MC 0x7840
Expand Down Expand Up @@ -1286,7 +1286,7 @@ static u32 knl_get_mc_route(int entry, u32 reg)
mc = GET_BITFIELD(reg, entry*3, (entry*3)+2);
chan = GET_BITFIELD(reg, (entry*2) + 18, (entry*2) + 18 + 1);

return knl_channel_remap(mc*3 + chan);
return knl_channel_remap(mc, chan);
}

/*
Expand Down Expand Up @@ -2997,8 +2997,15 @@ static void sbridge_mce_output_error(struct mem_ctl_info *mci,
} else {
char A = *("A");

channel = knl_channel_remap(channel);
/*
* Reported channel is in range 0-2, so we can't map it
* back to mc. To figure out mc we check machine check
* bank register that reported this error.
* bank15 means mc0 and bank16 means mc1.
*/
channel = knl_channel_remap(m->bank == 16, channel);
channel_mask = 1 << channel;

snprintf(msg, sizeof(msg),
"%s%s err_code:%04x:%04x channel:%d (DIMM_%c)",
overflow ? " OVERFLOW" : "",
Expand Down
14 changes: 9 additions & 5 deletions drivers/iommu/dma-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ void iommu_put_dma_cookie(struct iommu_domain *domain)
if (!iovad)
return;

put_iova_domain(iovad);
if (iovad->granule)
put_iova_domain(iovad);
kfree(iovad);
domain->iova_cookie = NULL;
}
Expand Down Expand Up @@ -151,12 +152,15 @@ int dma_direction_to_prot(enum dma_data_direction dir, bool coherent)
}
}

static struct iova *__alloc_iova(struct iova_domain *iovad, size_t size,
static struct iova *__alloc_iova(struct iommu_domain *domain, size_t size,
dma_addr_t dma_limit)
{
struct iova_domain *iovad = domain->iova_cookie;
unsigned long shift = iova_shift(iovad);
unsigned long length = iova_align(iovad, size) >> shift;

if (domain->geometry.force_aperture)
dma_limit = min(dma_limit, domain->geometry.aperture_end);
/*
* Enforce size-alignment to be safe - there could perhaps be an
* attribute to control this per-device, or at least per-domain...
Expand Down Expand Up @@ -314,7 +318,7 @@ struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp,
if (!pages)
return NULL;

iova = __alloc_iova(iovad, size, dev->coherent_dma_mask);
iova = __alloc_iova(domain, size, dev->coherent_dma_mask);
if (!iova)
goto out_free_pages;

Expand Down Expand Up @@ -386,7 +390,7 @@ dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page,
phys_addr_t phys = page_to_phys(page) + offset;
size_t iova_off = iova_offset(iovad, phys);
size_t len = iova_align(iovad, size + iova_off);
struct iova *iova = __alloc_iova(iovad, len, dma_get_mask(dev));
struct iova *iova = __alloc_iova(domain, len, dma_get_mask(dev));

if (!iova)
return DMA_ERROR_CODE;
Expand Down Expand Up @@ -538,7 +542,7 @@ int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,
prev = s;
}

iova = __alloc_iova(iovad, iova_len, dma_get_mask(dev));
iova = __alloc_iova(domain, iova_len, dma_get_mask(dev));
if (!iova)
goto out_restore_sg;

Expand Down
6 changes: 3 additions & 3 deletions drivers/iommu/mtk_iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ struct mtk_iommu_data {
bool enable_4GB;
};

static int compare_of(struct device *dev, void *data)
static inline int compare_of(struct device *dev, void *data)
{
return dev->of_node == data;
}

static int mtk_iommu_bind(struct device *dev)
static inline int mtk_iommu_bind(struct device *dev)
{
struct mtk_iommu_data *data = dev_get_drvdata(dev);

return component_bind_all(dev, &data->smi_imu);
}

static void mtk_iommu_unbind(struct device *dev)
static inline void mtk_iommu_unbind(struct device *dev)
{
struct mtk_iommu_data *data = dev_get_drvdata(dev);

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ module_param(lacp_rate, charp, 0);
MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner; "
"0 for slow, 1 for fast");
module_param(ad_select, charp, 0);
MODULE_PARM_DESC(ad_select, "803.ad aggregation selection logic; "
MODULE_PARM_DESC(ad_select, "802.3ad aggregation selection logic; "
"0 for stable (default), 1 for bandwidth, "
"2 for count");
module_param(min_links, int, 0);
Expand Down
Loading

0 comments on commit 9d5cf2b

Please sign in to comment.