03 Mar, 2018

40 commits

  • [ Upstream commit bbc25bee37d2b32cf3a1fab9195b6da3a185614a ]

    Current MIPS64r6 toolchains aren't able to generate efficient
    DMULU/DMUHU based code for the C implementation of umul_ppmm(), which
    performs an unsigned 64 x 64 bit multiply and returns the upper and
    lower 64-bit halves of the 128-bit result. Instead it widens the 64-bit
    inputs to 128-bits and emits a __multi3 intrinsic call to perform a 128
    x 128 multiply. This is both inefficient, and it results in a link error
    since we don't include __multi3 in MIPS linux.

    For example commit 90a53e4432b1 ("cfg80211: implement regdb signature
    checking") merged in v4.15-rc1 recently broke the 64r6_defconfig and
    64r6el_defconfig builds by indirectly selecting MPILIB. The same build
    errors can be reproduced on older kernels by enabling e.g. CRYPTO_RSA:

    lib/mpi/generic_mpih-mul1.o: In function `mpihelp_mul_1':
    lib/mpi/generic_mpih-mul1.c:50: undefined reference to `__multi3'
    lib/mpi/generic_mpih-mul2.o: In function `mpihelp_addmul_1':
    lib/mpi/generic_mpih-mul2.c:49: undefined reference to `__multi3'
    lib/mpi/generic_mpih-mul3.o: In function `mpihelp_submul_1':
    lib/mpi/generic_mpih-mul3.c:49: undefined reference to `__multi3'
    lib/mpi/mpih-div.o In function `mpihelp_divrem':
    lib/mpi/mpih-div.c:205: undefined reference to `__multi3'
    lib/mpi/mpih-div.c:142: undefined reference to `__multi3'

    Therefore add an efficient MIPS64r6 implementation of umul_ppmm() using
    inline assembly and the DMULU/DMUHU instructions, to prevent __multi3
    calls being emitted.

    Fixes: 7fd08ca58ae6 ("MIPS: Add build support for the MIPS R6 ISA")
    Signed-off-by: James Hogan
    Cc: Ralf Baechle
    Cc: Herbert Xu
    Cc: "David S. Miller"
    Cc: linux-mips@linux-mips.org
    Cc: linux-crypto@vger.kernel.org
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    James Hogan
     
  • [ Upstream commit af955bf15d2c27496b0269b1f05c26f758c68314 ]

    This variable was increased and decreased without any protection.
    Result was an occasional misscount and negative wrap around resulting
    in false resource allocation failures.

    Fixes: 7d2c3f54e6f6 ("crypto: af_alg - remove locking in async callback")
    Signed-off-by: Jonathan Cameron
    Reviewed-by: Stephan Mueller
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jonathan Cameron
     
  • [ Upstream commit 506e8a912661c97b41adc8a286b875d01323ec45 ]

    dtc warns about two 'clocks' properties that have an extraneous '1'
    at the end:

    arch/arm/boot/dts/ls1021a-qds.dtb: Warning (clocks_property): arch/arm/boot/dts/ls1021a-twr.dtb: Warning (clocks_property): Property 'clocks', cell 1 is not a phandle reference in /soc/i2c@2180000/mux@77/i2c@4/sgtl5000@2a
    arch/arm/boot/dts/ls1021a-qds.dtb: Warning (clocks_property): Missing property '#clock-cells' in node /soc/interrupt-controller@1400000 or bad phandle (referred from /soc/i2c@2180000/mux@77/i2c@4/sgtl5000@2a:clocks[1])
    Property 'clocks', cell 1 is not a phandle reference in /soc/i2c@2190000/sgtl5000@a
    arch/arm/boot/dts/ls1021a-twr.dtb: Warning (clocks_property): Missing property '#clock-cells' in node /soc/interrupt-controller@1400000 or bad phandle (referred from /soc/i2c@2190000/sgtl5000@a:clocks[1])

    The clocks that get referenced here are fixed-rate, so they do not
    take any argument, and dtc interprets the next cell as a phandle, which
    is invalid.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     
  • [ Upstream commit 17748056ce123ee37fb7382bc698fc721e3c4a09 ]

    The QP cleanup did not previously call ib_umem_release,
    resulting in a user-triggerable kernel resource leak.

    Fixes: 29c8d9eba550 ("IB: Add vmw_pvrdma driver")
    Reviewed-by: Adit Ranadive
    Reviewed-by: Aditya Sarwade
    Reviewed-by: Jorgen Hansen
    Signed-off-by: Bryan Tan
    Signed-off-by: Jason Gunthorpe
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Bryan Tan
     
  • [ Upstream commit 8bc0d7ac934b6f2d0dc8f38a3104d281c9db1e98 ]

    Current code advertises (on the modifiers blob property) support for CCS
    modifier for pipe C on GLK, only to reject it later when validating the
    request before the atomic commit.

    This fixes the tests igt@kms_ccs@pipe-c-*, which should skip on GLK for
    pipe C (see bug 104096).

    A relevant discussion is archived at:

    https://lists.freedesktop.org/archives/intel-gfx/2017-December/150646.html

    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104096
    Signed-off-by: Gabriel Krisman Bertazi
    Cc: Ben Widawsky
    Reviewed-by: Ben Widawsky
    Signed-off-by: Rodrigo Vivi
    Link: https://patchwork.freedesktop.org/patch/msgid/20171220002410.5604-1-krisman@collabora.co.uk
    (cherry picked from commit f0cbd8bd877f3d8c5b80a6b1add9ca9010d7f9d8)
    Signed-off-by: Jani Nikula
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Gabriel Krisman Bertazi
     
  • [ Upstream commit 4c82fd0abb87e20d0d68ef5237e74732352806c8 ]

    nft_ct exposes this bit to userspace. This used to be

    #define NF_CT_STATE_UNTRACKED_BIT (1 << (IP_CT_NUMBER + 1))
    (IP_CT_NUMBER is 5, so this was 0x40)

    .. but this got changed to 8 (0x100) when the untracked object got removed.
    Replace this with a literal 6 to prevent further incompatible changes
    in case IP_CT_NUMBER ever increases.

    Fixes: cc41c84b7e7f2 ("netfilter: kill the fake untracked conntrack objects")
    Reported-by: Li Shuang
    Signed-off-by: Florian Westphal
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Florian Westphal
     
  • [ Upstream commit d1b8b2391c24751e44f618fcf86fb55d9a9247fd ]

    When an I/O is returned with an srb_status of SRB_STATUS_INVALID_LUN
    which has zero good_bytes it must be assigned an error. Otherwise the
    I/O will be continuously requeued and will cause a deadlock in the case
    where disks are being hot added and removed. sd_probe_async will wait
    forever for its I/O to complete while holding scsi_sd_probe_domain.

    Also returning the default error of DID_TARGET_FAILURE causes multipath
    to not retry the I/O resulting in applications receiving I/O errors
    before a failover can occur.

    Signed-off-by: Cathy Avery
    Signed-off-by: Long Li
    Reviewed-by: Stephen Hemminger
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Cathy Avery
     
  • [ Upstream commit 24c0df82ef7919e4d10cf2e4e65d368eb2e8ea21 ]

    ctx->chain may be null now that we have very large object names,
    so we cannot check for ctx->chain[0] here.

    Fixes: b7263e071aba7 ("netfilter: nf_tables: Allow table names of up to 255 chars")
    Signed-off-by: Pablo Neira Ayuso
    Acked-by: Phil Sutter
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Pablo Neira Ayuso
     
  • [ Upstream commit b3cf8528bb21febb650a7ecbf080d0647be40b9f ]

    Commit f5775e0b6116 ("x86/xen: discard RAM regions above the maximum
    reservation") left host memory not assigned to dom0 as available for
    memory hotplug.

    Unfortunately this also meant that those regions could be used by
    others. Specifically, commit fa564ad96366 ("x86/PCI: Enable a 64bit BAR
    on AMD Family 15h (Models 00-1f, 30-3f, 60-7f)") may try to map those
    addresses as MMIO.

    To prevent this mark unallocated host memory as E820_TYPE_UNUSABLE (thus
    effectively reverting f5775e0b6116) and keep track of that region as
    a hostmem resource that can be used for the hotplug.

    Signed-off-by: Boris Ostrovsky
    Reviewed-by: Juergen Gross
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Boris Ostrovsky
     
  • [ Upstream commit d5aa24825da5711f8cb829f873160ddf1a29b19c ]

    BRGCKR should use 0x80770000, instead of 0x80FF0000.

    R-Car Gen2 xxx_TIMSEL should use 0x0F1F,
    R-Car Gen3 xxx_TIMSEL should use 0x1F1F.
    Here, Gen3 doesn't support AVD, thus, both case can use 0x0F1F.

    Signed-off-by: Kuninori Morimoto
    Reviewed-by: Hiroyuki Yokoyama
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Kuninori Morimoto
     
  • [ Upstream commit a2fba188fd5eadd6061bef4f2f2577a43231ebf3 ]

    During unload, on mlx5_stop_eqs we move command interface from events
    mode to polling mode, but if command interface EQ destroy fail we move
    back to events mode.
    That's wrong since even if we fail to destroy command interface EQ, we
    do release its irq, so no interrupts will be received.

    Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
    Signed-off-by: Moshe Shemesh
    Signed-off-by: Saeed Mahameed
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Moshe Shemesh
     
  • [ Upstream commit d6b2785cd55ee72e9608762650b3ef299f801b1b ]

    When mlx5_stop_eqs fails to destroy any of the eqs it returns with an error.
    In such failure flow the function will return without
    releasing all EQs irqs and then pci_free_irq_vectors will fail.
    Fix by only warn on destroy EQ failure and continue to release other
    EQs and their irqs.

    It fixes the following kernel trace:
    kernel: kernel BUG at drivers/pci/msi.c:352!
    ...
    ...
    kernel: Call Trace:
    kernel: pci_disable_msix+0xd3/0x100
    kernel: pci_free_irq_vectors+0xe/0x20
    kernel: mlx5_load_one.isra.17+0x9f5/0xec0 [mlx5_core]

    Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
    Signed-off-by: Moshe Shemesh
    Signed-off-by: Saeed Mahameed
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Moshe Shemesh
     
  • [ Upstream commit ff0891915cd7b24ab27eee9b360c0452853bf9f6 ]

    Fix bug that allows ets bw sum to be 0% when ets tc type exists.

    Fixes: 08fb1dacdd76 ('net/mlx5e: Support DCBNL IEEE ETS')
    Signed-off-by: Moshe Shemesh
    Reviewed-by: Huy Nguyen
    Signed-off-by: Saeed Mahameed
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Huy Nguyen
     
  • [ Upstream commit a1762456993893795030d911106a7650481db0ef ]

    As noted in dwmac4_wrback_get_rx_timestamp_status the timestamp is found
    in the context descriptor following the current descriptor. However the
    current code looks for the context descriptor in the current
    descriptor, which will always fail.

    Signed-off-by: Fredrik Hallenberg
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Fredrik Hallenberg
     
  • [ Upstream commit 200922c93f008e03ddc804c6dacdf26ca1ba86d7 ]

    When using GMAC4 the value written in PTP_SSIR should be shifted however
    the shifted value is also used in subsequent calculations which results
    in a bad timestamp value.

    Signed-off-by: Fredrik Hallenberg
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Fredrik Hallenberg
     
  • [ Upstream commit c9fefa08190fc879fb2e681035d7774e0a8c5170 ]

    Now it's using IPV6_MIN_MTU as the min mtu in ip6_tnl_xmit, but
    IPV6_MIN_MTU actually only works when the inner packet is ipv6.

    With IPV6_MIN_MTU for ipv4 packets, the new pmtu for inner dst
    couldn't be set less than 1280. It would cause tx_err and the
    packet to be dropped when the outer dst pmtu is close to 1280.

    Jianlin found it by running ipv4 traffic with the topo:

    (client) gre6 eth1 (route) eth2 gre6 (server)

    After changing eth2 mtu to 1300, the performance became very
    low, or the connection was even broken. The issue also affects
    ip4ip6 and ip6ip6 tunnels.

    So if the inner packet is ipv4, 576 should be considered as the
    min mtu.

    Note that for ip4ip6 and ip6ip6 tunnels, the inner packet can
    only be ipv4 or ipv6, but for gre6 tunnel, it may also be ARP.
    This patch using 576 as the min mtu for non-ipv6 packet works
    for all those cases.

    Reported-by: Jianlin Shi
    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Xin Long
     
  • [ Upstream commit 2c52129a7d74d017320804c6928de770815c5f4a ]

    The same fix as the patch "ip_gre: remove the incorrect mtu limit for
    ipgre tap" is also needed for ip6_gre.

    Fixes: 61e84623ace3 ("net: centralize net_device min/max MTU checking")
    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Xin Long
     
  • [ Upstream commit cfddd4c33c254954927942599d299b3865743146 ]

    ipgre tap driver calls ether_setup(), after commit 61e84623ace3
    ("net: centralize net_device min/max MTU checking"), the range
    of mtu is [min_mtu, max_mtu], which is [68, 1500] by default.

    It causes the dev mtu of the ipgre tap device to not be greater
    than 1500, this limit value is not correct for ipgre tap device.

    Besides, it's .change_mtu already does the right check. So this
    patch is just to set max_mtu as 0, and leave the check to it's
    .change_mtu.

    Fixes: 61e84623ace3 ("net: centralize net_device min/max MTU checking")
    Reported-by: Jianlin Shi
    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Xin Long
     
  • [ Upstream commit a93bf0ff449064e6b7f44e58522e940f88c0d966 ]

    Unlike ip tunnels, now vxlan doesn't do any pmtu update for
    upper dst pmtu, even if it doesn't match the lower dst pmtu
    any more.

    The problem can be reproduced when reducing the vxlan lower
    dev's pmtu when running netperf. In jianlin's testing, the
    performance went to 1/7 of the previous.

    This patch is to update the upper dst pmtu to match the lower
    dst pmtu on tx path so that packets can be sent out even when
    lower dev's pmtu has been changed.

    It also works for metadata dst.

    Note that this patch doesn't process any pmtu icmp packet.
    But even in the future, the support for pmtu icmp packets
    process of udp tunnels will also needs this.

    The same thing will be done for geneve in another patch.

    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Xin Long
     
  • [ Upstream commit e688822d035b494071ecbadcccbd6f3325fb0f59 ]

    arc_emac_rx() has some issues found by code review.

    In case netdev_alloc_skb_ip_align() or dma_map_single() failure
    rx fifo entry will not be returned to EMAC.

    In case dma_map_single() failure previously allocated skb became
    lost to driver. At the same time address of newly allocated skb
    will not be provided to EMAC.

    Signed-off-by: Alexander Kochetkov
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Alexander Kochetkov
     
  • [ Upstream commit 7352e252b5bf40d59342494a70354a2d436fd0cd ]

    The current solution would setup fixed and force link of 1Gbps to the both
    GMAC on the default. However, The GMAC should always be put to link down
    state when the GMAC is disabled on certain target boards. Otherwise,
    the driver possibly receives unexpected data from the floating hardware
    connection through the unused GMAC. Although the driver had been added
    certain protection in RX path to get rid of such kind of unexpected data
    sent to the upper stack.

    Signed-off-by: Sean Wang
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sean Wang
     
  • [ Upstream commit 2cc42bac1c795f75fcc062b95c6ca7ac1b84d5d8 ]

    A few thousand such pages are usually left around due to the re-use of
    L1 tables having been provided by the hypervisor (Dom0) or tool stack
    (DomU). Set NX in the direct map variant, which needs to be done in L2
    due to the dual use of the re-used L1s.

    For x86_configure_nx() to actually do what it is supposed to do, call
    get_cpu_cap() first. This was broken by commit 4763ed4d45 ("x86, mm:
    Clean up and simplify NX enablement") when switching away from the
    direct EFER read.

    Signed-off-by: Jan Beulich
    Reviewed-by: Juergen Gross
    Signed-off-by: Boris Ostrovsky
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jan Beulich
     
  • [ Upstream commit f292b9b28097d8fe870336108e91bd95a14294bf ]

    In trying to add support for drm_hwcomposer to HiKey,
    I've needed to utilize the ION CMA heap, and I've noticed
    problems with allocations on newer kernels failing.

    It seems back with 204f672255c2 ("ion: Use CMA APIs directly"),
    the ion_cma_heap code was modified to use the CMA API, but
    kept the arguments as buffer lengths rather then number of pages.

    This results in errors as we don't have enough pages in CMA to
    satisfy the exaggerated requests.

    This patch converts the ion_cma_heap CMA API usage to properly
    request pages.

    It also fixes a minor issue in the allocation where in the error
    path, the cma_release is called with the buffer->size value which
    hasn't yet been set.

    Cc: Laura Abbott
    Cc: Sumit Semwal
    Cc: Benjamin Gaignard
    Cc: Archit Taneja
    Cc: Greg KH
    Cc: Daniel Vetter
    Cc: Dmitry Shmidt
    Cc: Todd Kjos
    Cc: Amit Pundir
    Fixes: 204f672255c2 ("staging: android: ion: Use CMA APIs directly")
    Acked-by: Laura Abbott
    Signed-off-by: John Stultz
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    John Stultz
     
  • [ Upstream commit 116d2f7496c51b2e02e8e4ecdd2bdf5fb9d5a641 ]

    Deadlock during cgroup migration from cpu hotplug path when a task T is
    being moved from source to destination cgroup.

    kworker/0:0
    cpuset_hotplug_workfn()
    cpuset_hotplug_update_tasks()
    hotplug_update_tasks_legacy()
    remove_tasks_in_empty_cpuset()
    cgroup_transfer_tasks() // stuck in iterator loop
    cgroup_migrate()
    cgroup_migrate_add_task()

    In cgroup_migrate_add_task() it checks for PF_EXITING flag of task T.
    Task T will not migrate to destination cgroup. css_task_iter_start()
    will keep pointing to task T in loop waiting for task T cg_list node
    to be removed.

    Task T
    do_exit()
    exit_signals() // sets PF_EXITING
    exit_task_namespaces()
    switch_task_namespaces()
    free_nsproxy()
    put_mnt_ns()
    drop_collected_mounts()
    namespace_unlock()
    synchronize_rcu()
    _synchronize_rcu_expedited()
    schedule_work() // on cpu0 low priority worker pool
    wait_event() // waiting for work item to execute

    Task T inserted a work item in the worklist of cpu0 low priority
    worker pool. It is waiting for expedited grace period work item
    to execute. This work item will only be executed once kworker/0:0
    complete execution of cpuset_hotplug_workfn().

    kworker/0:0 ==> Task T ==>kworker/0:0

    In case of PF_EXITING task being migrated from source to destination
    cgroup, migrate next available task in source cgroup.

    Signed-off-by: Prateek Sood
    Signed-off-by: Tejun Heo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Prateek Sood
     
  • [ Upstream commit d070f7c703ef26e3db613f24206823f916272fc6 ]

    In skylake platform, we hear a loud pop noise(0 dB) at start of
    audio capture power up sequence. This patch removes the pop noise
    from the recording by adding a delay before enabling ADC.

    Signed-off-by: Abhijeet Kumar
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Abhijeet Kumar
     
  • [ Upstream commit 66e900a3d225575c8b48b59ae1fe74bb6e5a65cc ]

    The only part of atmel_spi_remove which needs to be atomic is hardware
    reset.

    atmel_spi_stop_dma calls dma_terminate_all and this needs interrupts
    enabled.
    atmel_spi_release_dma calls dma_release_channel and dma_release_channel
    locks a mutex inside of spin_lock.

    So the call of these functions can't be inside a spin_lock.

    Reported-by: Jia-Ju Bai
    Signed-off-by: Radu Pirea
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Radu Pirea
     
  • [ Upstream commit 162bd5e5fd921785077b5862d8f2ffabe2fe11e5 ]

    The driver may sleep under a spinlock.
    The function call path is:
    hwsim_get_radio_nl (acquire the spinlock)
    nlmsg_new(GFP_KERNEL) --> may sleep

    To fix it, GFP_KERNEL is replaced with GFP_ATOMIC.

    This bug is found by my static analysis tool(DSAC) and checked by my code review.

    Signed-off-by: Jia-Ju Bai
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jia-Ju Bai
     
  • [ Upstream commit 6454b3bdd138dfc640deb5e7b9a0668fca2d55dd ]

    Commit:

    1959a60182f4 ("x86/dumpstack: Pin the target stack when dumping it")

    changed the behavior of stack traces for zombies. Before that commit,
    /proc//stack reported the last execution path of the zombie before
    it died:

    [] do_exit+0x6f7/0xa80
    [] do_group_exit+0x39/0xa0
    [] __wake_up_parent+0x0/0x30
    [] system_call_fastpath+0x16/0x1b
    [] 0x7fd128f9c4f9
    [] 0xffffffffffffffff

    After the commit, it just reports an empty stack trace.

    The new behavior is actually probably more correct. If the stack
    refcount has gone down to zero, then the task has already gone through
    do_exit() and isn't going to run anymore. The stack could be freed at
    any time and is basically gone, so reporting an empty stack makes sense.

    However, save_stack_trace_tsk_reliable() treats such a missing stack
    condition as an error. That can cause livepatch transition stalls if
    there are any unreaped zombies. Instead, just treat it as a reliable,
    empty stack.

    Reported-and-tested-by: Miroslav Benes
    Signed-off-by: Josh Poimboeuf
    Cc: Andy Lutomirski
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: live-patching@vger.kernel.org
    Fixes: af085d9084b4 ("stacktrace/x86: add function for detecting reliable stack traces")
    Link: http://lkml.kernel.org/r/e4b09e630e99d0c1080528f0821fc9d9dbaeea82.1513631620.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Josh Poimboeuf
     
  • [ Upstream commit acf568ee859f098279eadf551612f103afdacb4e ]

    This is an old bugbear of mine:

    https://www.mail-archive.com/netdev@vger.kernel.org/msg03894.html

    By crafting special packets, it is possible to cause recursion
    in our kernel when processing transport-mode packets at levels
    that are only limited by packet size.

    The easiest one is with DNAT, but an even worse one is where
    UDP encapsulation is used in which case you just have to insert
    an UDP encapsulation header in between each level of recursion.

    This patch avoids this problem by reinjecting tranport-mode packets
    through a tasklet.

    Fixes: b05e106698d9 ("[IPV4/6]: Netfilter IPsec input hooks")
    Signed-off-by: Herbert Xu
    Signed-off-by: Steffen Klassert
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Herbert Xu
     
  • [ Upstream commit a121027d2747168df0aac0c3da35509eea39f61c ]

    On my GP107 when I load nouveau after unloading it, for some reason the
    GPU stopped sending or the CPU stopped receiving interrupts if MSI was
    enabled.

    Doing a rearm once before getting any interrupts fixes this.

    Signed-off-by: Karol Herbst
    Reviewed-by: Thierry Reding
    Signed-off-by: Ben Skeggs
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Karol Herbst
     
  • [ Upstream commit ab14436065c8066c265540312742390d6d07ddd2 ]

    There are several error paths in xgene_mdio_probe(),
    where clk is left undisabled. The patch fixes them.

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Alexey Khoroshilov
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Alexey Khoroshilov
     
  • [ Upstream commit 9ee332d99e4d5a97548943b81c54668450ce641b ]

    Signed-off-by: Al Viro
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Al Viro
     
  • [ Upstream commit 5c468674d17056148da06218d4da5d04baf22eac ]

    Now when reneging events in sctp_ulpq_renege(), the variable freed
    could be increased by a __u16 value twice while freed is of __u16
    type. It means freed may overflow at the second addition.

    This patch is to fix it by using __u32 type for 'freed', while at
    it, also to remove 'if (chunk)' check, as all renege commands are
    generated in sctp_eat_data and it can't be NULL.

    Reported-by: Marcelo Ricardo Leitner
    Signed-off-by: Xin Long
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Xin Long
     
  • [ Upstream commit ca26cffa4e4aaeb09bb9e308f95c7835cb149248 ]

    Up to f5caf621ee35 ("x86/asm: Fix inline asm call constraints for Clang")
    we were able to use x86 headers to build to the 'bpf' clang target, as
    done by the BPF code in tools/perf/.

    With that commit, we ended up with following failure for 'perf test LLVM', this
    is because "clang ... -target bpf ..." fails since 4.0 does not have bpf inline
    asm support and 6.0 does not recognize the register 'esp', fix it by guarding
    that part with an #ifndef __BPF__, that is defined by clang when building to
    the "bpf" target.

    # perf test -v LLVM
    37: LLVM search and compile :
    37.1: Basic BPF llvm compile :
    --- start ---
    test child forked, pid 25526
    Kernel build dir is set to /lib/modules/4.14.0+/build
    set env: KBUILD_DIR=/lib/modules/4.14.0+/build
    unset env: KBUILD_OPTS
    include option is set to -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h
    set env: NR_CPUS=4
    set env: LINUX_VERSION_CODE=0x40e00
    set env: CLANG_EXEC=/usr/local/bin/clang
    set env: CLANG_OPTIONS=-xc
    set env: KERNEL_INC_OPTIONS= -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h
    set env: WORKING_DIR=/lib/modules/4.14.0+/build
    set env: CLANG_SOURCE=-
    llvm compiling command template: echo '/*
    * bpf-script-example.c
    * Test basic LLVM building
    */
    #ifndef LINUX_VERSION_CODE
    # error Need LINUX_VERSION_CODE
    # error Example: for 4.2 kernel, put 'clang-opt="-DLINUX_VERSION_CODE=0x40200" into llvm section of ~/.perfconfig'
    #endif
    #define BPF_ANY 0
    #define BPF_MAP_TYPE_ARRAY 2
    #define BPF_FUNC_map_lookup_elem 1
    #define BPF_FUNC_map_update_elem 2

    static void *(*bpf_map_lookup_elem)(void *map, void *key) =
    (void *) BPF_FUNC_map_lookup_elem;
    static void *(*bpf_map_update_elem)(void *map, void *key, void *value, int flags) =
    (void *) BPF_FUNC_map_update_elem;

    struct bpf_map_def {
    unsigned int type;
    unsigned int key_size;
    unsigned int value_size;
    unsigned int max_entries;
    };

    #define SEC(NAME) __attribute__((section(NAME), used))
    struct bpf_map_def SEC("maps") flip_table = {
    .type = BPF_MAP_TYPE_ARRAY,
    .key_size = sizeof(int),
    .value_size = sizeof(int),
    .max_entries = 1,
    };

    SEC("func=SyS_epoll_wait")
    int bpf_func__SyS_epoll_wait(void *ctx)
    {
    int ind =0;
    int *flag = bpf_map_lookup_elem(&flip_table, &ind);
    int new_flag;
    if (!flag)
    return 0;
    /* flip flag and store back */
    new_flag = !*flag;
    bpf_map_update_elem(&flip_table, &ind, &new_flag, BPF_ANY);
    return new_flag;
    }
    char _license[] SEC("license") = "GPL";
    int _version SEC("version") = LINUX_VERSION_CODE;
    ' | $CLANG_EXEC -D__KERNEL__ -D__NR_CPUS__=$NR_CPUS -DLINUX_VERSION_CODE=$LINUX_VERSION_CODE $CLANG_OPTIONS $KERNEL_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c "$CLANG_SOURCE" -target bpf -O2 -o -
    test child finished with 0
    ---- end ----
    LLVM search and compile subtest 0: Ok
    37.2: kbuild searching :
    --- start ---
    test child forked, pid 25950
    Kernel build dir is set to /lib/modules/4.14.0+/build
    set env: KBUILD_DIR=/lib/modules/4.14.0+/build
    unset env: KBUILD_OPTS
    include option is set to -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h
    set env: NR_CPUS=4
    set env: LINUX_VERSION_CODE=0x40e00
    set env: CLANG_EXEC=/usr/local/bin/clang
    set env: CLANG_OPTIONS=-xc
    set env: KERNEL_INC_OPTIONS= -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h
    set env: WORKING_DIR=/lib/modules/4.14.0+/build
    set env: CLANG_SOURCE=-
    llvm compiling command template: echo '/*
    * bpf-script-test-kbuild.c
    * Test include from kernel header
    */
    #ifndef LINUX_VERSION_CODE
    # error Need LINUX_VERSION_CODE
    # error Example: for 4.2 kernel, put 'clang-opt="-DLINUX_VERSION_CODE=0x40200" into llvm section of ~/.perfconfig'
    #endif
    #define SEC(NAME) __attribute__((section(NAME), used))

    #include
    #include

    SEC("func=vfs_llseek")
    int bpf_func__vfs_llseek(void *ctx)
    {
    return 0;
    }

    char _license[] SEC("license") = "GPL";
    int _version SEC("version") = LINUX_VERSION_CODE;
    ' | $CLANG_EXEC -D__KERNEL__ -D__NR_CPUS__=$NR_CPUS -DLINUX_VERSION_CODE=$LINUX_VERSION_CODE $CLANG_OPTIONS $KERNEL_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c "$CLANG_SOURCE" -target bpf -O2 -o -
    In file included from :12:
    In file included from /home/acme/git/linux/arch/x86/include/uapi/asm/ptrace.h:5:
    In file included from /home/acme/git/linux/include/linux/compiler.h:242:
    In file included from /home/acme/git/linux/arch/x86/include/asm/barrier.h:5:
    In file included from /home/acme/git/linux/arch/x86/include/asm/alternative.h:10:
    /home/acme/git/linux/arch/x86/include/asm/asm.h:145:50: error: unknown register name 'esp' in asm
    register unsigned long current_stack_pointer asm(_ASM_SP);
    ^
    /home/acme/git/linux/arch/x86/include/asm/asm.h:44:18: note: expanded from macro '_ASM_SP'
    #define _ASM_SP __ASM_REG(sp)
    ^
    /home/acme/git/linux/arch/x86/include/asm/asm.h:27:32: note: expanded from macro '__ASM_REG'
    #define __ASM_REG(reg) __ASM_SEL_RAW(e##reg, r##reg)
    ^
    /home/acme/git/linux/arch/x86/include/asm/asm.h:18:29: note: expanded from macro '__ASM_SEL_RAW'
    # define __ASM_SEL_RAW(a,b) __ASM_FORM_RAW(a)
    ^
    /home/acme/git/linux/arch/x86/include/asm/asm.h:11:32: note: expanded from macro '__ASM_FORM_RAW'
    # define __ASM_FORM_RAW(x) #x
    ^
    :4:1: note: expanded from here
    "esp"
    ^
    1 error generated.
    ERROR: unable to compile -
    Hint: Check error message shown above.
    Hint: You can also pre-compile it into .o using:
    clang -target bpf -O2 -c -
    with proper -I and -D options.
    Failed to compile test case: 'kbuild searching'
    test child finished with -1
    ---- end ----
    LLVM search and compile subtest 1: FAILED!

    Cc: Adrian Hunter
    Cc: Alexander Potapenko
    Cc: Alexei Starovoitov
    Cc: Andrey Ryabinin
    Cc: Andy Lutomirski
    Cc: Arnd Bergmann
    Cc: Daniel Borkmann
    Cc: David Ahern
    Cc: Dmitriy Vyukov
    Cc: Jiri Olsa
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Matthias Kaehlcke
    Cc: Miguel Bernal Marin
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Wang Nan
    Cc: Yonghong Song
    Link: https://lkml.kernel.org/r/20171128175948.GL3298@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Arnaldo Carvalho de Melo
     
  • [ Upstream commit 36b0cb84ee858f02c256d26f0cb4229c78e3399e ]

    An additional 'ip' will be pushed to the stack, for restoring the
    DACR later, if CONFIG_CPU_SW_DOMAIN_PAN defined.

    However, the fixup still get the err_ptr by add #8*4 to sp, which
    results in the fact that the code area pointed by the LR will be
    overwritten, or the kernel will crash if CONFIG_DEBUG_RODATA is enabled.

    This patch fixes the stack mismatch.

    Fixes: a5e090acbf54 ("ARM: software-based priviledged-no-access support")
    Signed-off-by: Lvqiang Huang
    Signed-off-by: Chunyan Zhang
    Signed-off-by: Russell King
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Chunyan Zhang
     
  • [ Upstream commit da57c5414f49ef9e4bcb9ae0bbafd1d650b31411 ]

    In testing, I found that the thread stack can be 16 kB when using an irq
    stack. Without it, the thread stack needs to be 32 kB. Currently, the irq
    stack is 32 kB. While it probably could be 16 kB, I would prefer to leave it
    as is for safety.

    Signed-off-by: John David Anglin
    Signed-off-by: Helge Deller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    John David Anglin
     
  • [ Upstream commit 588753f1eb18978512b1c9b85fddb457d46f9033 ]

    One example of when an ICMPv6 packet is required to be looped back is
    when a host acts as both a Multicast Listener and a Multicast Router.

    A Multicast Router will listen on address ff02::16 for MLDv2 messages.

    Currently, MLDv2 messages originating from a Multicast Listener running
    on the same host as the Multicast Router are not being delivered to the
    Multicast Router. This is due to dst.input being assigned the default
    value of dst_discard.

    This results in the packet being looped back but discarded before being
    delivered to the Multicast Router.

    This patch sets dst.input to ip6_input to ensure a looped back packet
    is delivered to the Multicast Router.

    Signed-off-by: Brendan McGrath
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Brendan McGrath
     
  • [ Upstream commit e44b9a9c135727f3410e029910275f40681dc8bc ]

    A negative return value of brcmstb_nand_verify_erased_page() indicates a
    real bitflip error of an erased page, and other return values (>= 0) show
    the corrected bitflip number. Zero return value means no bitflip, but the
    current driver code treats it as an error, and eventually leads to
    falsely reported ECC error.

    Fixes: 02b88eea9f9c ("mtd: brcmnand: Add check for erased page bitflip")
    Signed-off-by: Albert Hsieh
    Acked-by: Boris Brezillon
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Albert Hsieh
     
  • [ Upstream commit fdf2e821052958a114618a95ab18a300d0b080cb ]

    When erased subpages are read then the BCH decoder returns STATUS_ERASED
    if they are all empty, or STATUS_UNCORRECTABLE if there are bitflips.
    When there are bitflips, we have to set these bits again to show the
    upper layers a completely erased page. When a bitflip happens in the
    exact byte where the bad block marker is, then this byte is swapped
    with another byte in block_mark_swapping(). The correction code then
    detects a bitflip in another subpage and no longer corrects the bitflip
    where it really happens.

    Correct this behaviour by calling block_mark_swapping() after the
    bitflips have been corrected.

    In our case UBIFS failed with this bug because it expects erased
    pages to be really empty:

    UBIFS error (pid 187): ubifs_scan: corrupt empty space at LEB 36:118735
    UBIFS error (pid 187): ubifs_scanned_corruption: corruption at LEB 36:118735
    UBIFS error (pid 187): ubifs_scanned_corruption: first 8192 bytes from LEB 36:118735
    UBIFS error (pid 187): ubifs_scan: LEB 36 scanning failed
    UBIFS error (pid 187): do_commit: commit failed, error -117

    Signed-off-by: Sascha Hauer
    Reviewed-by: Richard Weinberger
    Acked-by: Boris Brezillon
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sascha Hauer
     
  • [ Upstream commit c647c0d62c82eb3ddf78a0d8b3d58819d9f552aa ]

    This patch adds support for Telit ME910 PID 0x1101.

    Signed-off-by: Daniele Palmas
    Acked-by: Bjørn Mork
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Daniele Palmas