commit d19433b3d3b9b4f7b0d913403769c6b039389f0a
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed May 30 08:17:45 2018 +0200

    Linux 4.16.13

commit 8ade5e15bfd265e9a9afc43e0508070b67eab00f
Author: Deepak Rawat <drawat@vmware.com>
Date:   Tue May 15 15:39:09 2018 +0200

    drm/vmwgfx: Set dmabuf_size when vmw_dmabuf_init is successful
    
    commit 91ba9f28a3de97761c2b5fd5df5d88421268e507 upstream.
    
    SOU primary plane prepare_fb hook depends upon dmabuf_size to pin up BO
    (and not call a new vmw_dmabuf_init) when a new fb size is same as
    current fb. This was changed in a recent commit which is causing
    page_flip to fail on VM with low display memory and multi-mon failure
    when cycle monitors from secondary display.
    
    Cc: <stable@vger.kernel.org> # 4.14, 4.16
    Fixes: 20fb5a635a0c ("drm/vmwgfx: Unpin the screen object backup buffer when not used")
    Signed-off-by: Deepak Rawat <drawat@vmware.com>
    Reviewed-by: Sinclair Yeh <syeh@vmware.com>
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ac67ce3d0181ab3714b7bfb6507a9e825447f709
Author: Randy Dunlap <rdunlap@infradead.org>
Date:   Fri Dec 8 10:19:19 2017 -0800

    kdb: make "mdr" command repeat
    
    [ Upstream commit 1e0ce03bf142454f38a5fc050bf4fd698d2d36d8 ]
    
    The "mdr" command should repeat (continue) when only Enter/Return
    is pressed, so make it do so.
    
    Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
    Cc: Daniel Thompson <daniel.thompson@linaro.org>
    Cc: Jason Wessel <jason.wessel@windriver.com>
    Cc: kgdb-bugreport@lists.sourceforge.net
    Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e196ce5857c61b6de5186798c5ebf144c8c48f47
Author: Jan Kundrát <jan.kundrat@cesnet.cz>
Date:   Thu Jan 25 18:29:15 2018 +0100

    pinctrl: mcp23s08: spi: Fix regmap debugfs entries
    
    [ Upstream commit 9b3e4207661e67f04c72af15e29f74cd944f5964 ]
    
    The SPI version of this chip allows several devices to be present on the
    same SPI bus via a local address. If this is in action and if the kernel
    has debugfs, however, the code attempts to create duplicate entries for
    the regmap's debugfs:
    
      mcp23s08 spi1.1: Failed to create debugfs directory
    
    This patch simply assigns a local name matching the device logical
    address to the `struct regmap_config`.
    
    No changes are needed for MCP23S18 because that device does not support
    any logical addressing. Similarly, I2C devices do not need any action,
    either, because they are already different in their I2C address.
    
    A similar problem is present for the pinctrl debugfs instance, but that
    one is not addressed by this patch.
    
    Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7d8e0341b2b93fb505cd75e8e0d4f1911d0fa0fe
Author: Bjorn Andersson <bjorn.andersson@linaro.org>
Date:   Sun Jan 28 16:59:48 2018 -0800

    pinctrl: msm: Use dynamic GPIO numbering
    
    [ Upstream commit a7aa75a2a7dba32594291a71c3704000a2fd7089 ]
    
    The base of the TLMM gpiochip should not be statically defined as 0, fix
    this to not artificially restrict the existence of multiple pinctrl-msm
    devices.
    
    Fixes: f365be092572 ("pinctrl: Add Qualcomm TLMM driver")
    Reported-by: Timur Tabi <timur@codeaurora.org>
    Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6f17707b9c387e56b433188c94a1457e510fd2ba
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Fri Jan 26 23:13:44 2018 +0100

    regulator: of: Add a missing 'of_node_put()' in an error handling path of 'of_regulator_match()'
    
    [ Upstream commit 30966861a7a2051457be8c49466887d78cc47e97 ]
    
    If an unlikely failure in 'of_get_regulator_init_data()' occurs, we must
    release the reference on the current 'child' node before returning.
    
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d8ee8694e427fc4c1c32f05d17d37ddd639e6816
Author: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Date:   Sat Jan 13 01:14:23 2018 +0200

    ARM: dts: porter: Fix HDMI output routing
    
    [ Upstream commit d4b78db6ac3e084e2bdc57d5518bd247c727f396 ]
    
    The HDMI encoder is connected to the RGB output of the DU, which is
    port@0, not port@1. Fix the incorrect DT description.
    
    Fixes: c5af8a4248d3 ("ARM: dts: porter: add DU DT support")
    Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 23cff1ffbf5fc9b17238e8540691b9b014eca03b
Author: Aapo Vienamo <aapo@tuxera.com>
Date:   Wed Jan 31 14:34:07 2018 +0000

    ARM: dts: imx7d: cl-som-imx7: fix pinctrl_enet
    
    [ Upstream commit 2bada7ac1fdcbf79a9689bd2ff65fa515ca7a31f ]
    
    The missing last digit of the CONFIG values is added. Looks like a typo
    of some sort when comparing to the downstream dt. This fixes
    intermittent behavior behaviour of the ethernet controllers.
    
    Signed-off-by: Aapo Vienamo <aapo@tuxera.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d57206efbaa90e01a2ba4227b54c724b36bb9df8
Author: Filip Sadowski <filip.sadowski@intel.com>
Date:   Fri Dec 29 08:50:05 2017 -0500

    i40e: Add delay after EMP reset for firmware to recover
    
    [ Upstream commit 1fa51a650e1deb50410677f1bd6c0ce17aa48a49 ]
    
    This patch adds necessary delay for 4.33 firmware to recover after
    EMP reset. Without this patch driver occasionally reinitializes
    structures too quickly to communicate with firmware after EMP reset
    causing AdminQ to timeout.
    
    Signed-off-by: Filip Sadowski <filip.sadowski@intel.com>
    Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6ed70aa45afc356df10f100172585840c0bce891
Author: Heiner Kallweit <hkallweit1@gmail.com>
Date:   Thu Dec 21 20:41:02 2017 +0100

    soc: amlogic: meson-gx-pwrc-vpu: fix error on shutdown when domain is powered off
    
    [ Upstream commit 87f88732d25e6175cb4faa8070658f604660d720 ]
    
    When operating the system headless headless, the domain is never
    powered on, leaving the clocks disabled. The shutdown function then
    tries to disable the already disabled clocks, resulting in errors.
    Therefore call meson_gx_pwrc_vpu_power_off() only if domain is
    powered on.
    This patch fixes the described issue on my system (Odorid-C2).
    
    Fixes: 339cd0ea0822 "soc: amlogic: meson-gx-pwrc-vpu: fix power-off when powered by bootloader"
    Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
    Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
    Signed-off-by: Kevin Hilman <khilman@baylibre.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 27781e285b9a42f0cfed7aedaf17173d17048659
Author: Charles Keepax <ckeepax@opensource.cirrus.com>
Date:   Mon Feb 12 18:15:44 2018 +0000

    regmap: Correct comparison in regmap_cached
    
    [ Upstream commit 71df179363a5a733a8932e9afb869760d7559383 ]
    
    The cache pointer points to the actual memory used by the cache, as the
    comparison here is looking for the type of the cache it should check
    against cache_type.
    
    Fixes: 1ea975cf1ef5 ("regmap: Add a function to check if a regmap register is cached")
    Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7491974c5a5f65b6c986f5b65c091874fb35659d
Author: Peter Rosin <peda@axentia.se>
Date:   Tue Jan 16 17:06:18 2018 +0100

    ARM: dts: at91: tse850: use the correct compatible for the eeprom
    
    [ Upstream commit 7981190fb5dd710dea08c2613cee3d05e795ca5e ]
    
    The used part does contain an eeprom compatible with an Atmel 24c02
    chip and it is from NXP, but it is not called 24c02. It's actually a
    se97b chip. Adjust the compatible accordingly.
    
    Fixes: 21dd0ece34c2 ("ARM: dts: at91: add devicetree for the Axentia TSE-850")
    Signed-off-by: Peter Rosin <peda@axentia.se>
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a270543d21944eaff2062c08900468f9b92aec0e
Author: Peter Rosin <peda@axentia.se>
Date:   Tue Jan 16 17:06:17 2018 +0100

    ARM: dts: at91: nattis: use the correct compatible for the eeprom
    
    [ Upstream commit 6b65933008a6bbe5ff79a344b41175826848682d ]
    
    The used part does contain an eeprom compatible with an Atmel 24c02
    chip and it is from NXP, but it is not called 24c02. It's actually a
    se97b chip. Adjust the compatible accordingly.
    
    Fixes: 0e4323899973 ("ARM: dts: at91: add devicetree for the Axentia Nattis with Natte power")
    Signed-off-by: Peter Rosin <peda@axentia.se>
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5c8695af00bf73c9e71e8d7e4063099ea20a022f
Author: David Ahern <dsahern@gmail.com>
Date:   Tue Feb 13 08:44:06 2018 -0800

    selftests: Add FIB onlink tests
    
    [ Upstream commit 153e1b84f477f716bc3f81e6cfae1a3d941fc7ec ]
    
    Add test cases verifying FIB onlink commands work as expected in
    various conditions - IPv4, IPv6, main table, and VRF.
    
    Signed-off-by: David Ahern <dsahern@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 475033814e3304714c61d6bf851c637181cdc3a1
Author: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date:   Fri Jan 12 23:12:05 2018 +0300

    drm: rcar-du: lvds: Fix LVDS startup on R-Car Gen2
    
    [ Upstream commit 8525d04ba8a6a9ecfa4bd619c988ca873a5fc2a4 ]
    
    According to the latest revision 2.00 of the R-Car Gen2 manual, the LVDS
    and the bias circuit must be enabled after the LVDS I/O pins are
    enabled, not before. Fix the Gen2 LVDS startup sequence accordingly.
    
    While at it, also fix the comment preceding the first LVDCR0 write that
    still talks about hardcoding the LVDS mode 0.
    
    Fixes: 90374b5c25c9 ("drm/rcar-du: Add internal LVDS encoder support")
    Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
    Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    Tested-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 456aef5ed33319aa9acef14d1abf4a6511c750a9
Author: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date:   Fri Jan 12 23:12:04 2018 +0300

    drm: rcar-du: lvds: Fix LVDS startup on R-Car Gen3
    
    [ Upstream commit 796ceb9269626afaed3b4955c40d2c3d7a8c5d01 ]
    
    According to the latest revisions of the R-Car Gen3 manual, the LVDS mode
    must be set before the LVDS I/O pins are enabled, not after -- fix the
    Gen3 LVDS startup sequence accordingly.
    
    Fixes: e947eccbeba4 ("drm: rcar-du: Add support for LVDS mode selection")
    Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
    Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    [Updated comment in rcar_du_lvdsenc_start_gen3()]
    [Moved Gen2 startup comment update to separate commit]
    [Fixed =| typo]
    Tested-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit be44fb5e423c635dd3b498e874620cdc21d3b5ac
Author: Richard Haines <richard_c_haines@btinternet.com>
Date:   Mon Nov 13 20:54:22 2017 +0000

    netlabel: If PF_INET6, check sk_buff ip header version
    
    [ Upstream commit 213d7f94775322ba44e0bbb55ec6946e9de88cea ]
    
    When resolving a fallback label, check the sk_buff version as it
    is possible (e.g. SCTP) to have family = PF_INET6 while
    receiving ip_hdr(skb)->version = 4.
    
    Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
    Acked-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8f356a1fb2080ee910d1b82332575e276bbd2ef0
Author: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Date:   Fri Feb 2 21:12:53 2018 -0800

    drm/vblank: Data type fixes for 64-bit vblank sequences.
    
    [ Upstream commit 3b765c0b765d2cc03ef02276f1af2658a03b3ced ]
    
    drm_vblank_count() has an u32 type returning what is a 64-bit vblank count.
    The effect of this is when drm_wait_vblank_ioctl() tries to widen the user
    space requested vblank sequence using this clipped 32-bit count(when the
    value is >= 2^32) as reference, the requested sequence remains a 32-bit
    value and gets queued like that. However, the code that checks if the
    requested sequence has passed compares this against the 64-bit vblank
    count.
    
    With drm_vblank_count() returning all bits of the vblank count, update
    drm_crtc_accurate_vblank_count() so that drm_crtc_arm_vblank_event() queues
    the correct sequence. Otherwise, this leads to prolonged waits for a vblank
    sequence when the current count is >=2^32.
    
    Finally, fix drm_wait_one_vblank() too.
    
    v2: Commit message fix (Keith)
        Squash commits (Rodrigo)
    
    Fixes: 570e86963a51 ("drm: Widen vblank count to 64-bits [v3]")
    Cc: Keith Packard <keithp@keithp.com>
    Cc: Michel Dänzer <michel@daenzer.net>
    Cc: Daniel Vetter <daniel@ffwll.ch>
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
    Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20180203051302.9974-1-dhinakaran.pandiyan@intel.com
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a9dd95fe9958352c4277ddf6b421a0de32ad4828
Author: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Date:   Thu Feb 15 09:19:26 2018 +0900

    selftests/net: fixes psock_fanout eBPF test case
    
    [ Upstream commit ddd0010392d9cbcb95b53d11b7cafc67b373ab56 ]
    
    eBPF test fails due to verifier failure because log_buf is too small.
    Fixed by increasing log_buf size
    
    Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
    Acked-by: Willem de Bruijn <willemb@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 414046065fc91da471c4dceea71f34c36a77461e
Author: Jiri Olsa <jolsa@kernel.org>
Date:   Tue Feb 6 19:18:12 2018 +0100

    perf tests: Fix dwarf unwind for stripped binaries
    
    [ Upstream commit fdf7c49c200d1b9909e2204cec5bd68b48605c71 ]
    
    When we strip the perf binary, dwarf unwind test stop
    to work. The reason is that strip will remove static
    function symbols, which we need to check for unwind.
    
    This change will keep this test working in cases where
    the global symbols are put into dynamic symbol table,
    which is the case on x86. It still won't work on powerpc.
    
    Making those 5 local functions global, and adding
    'test_dwarf_unwind__' to their names.
    
    Committer testing:
    
    Before:
    
      # perf test dwarf
      58: DWARF unwind                               : Ok
      # strip ~/bin/perf
      # perf test dwarf
      58: DWARF unwind                               : FAILED!
      # perf test -v dwarf
      58: DWARF unwind                               :
      --- start ---
      test child forked, pid 6590
      unwind: thread map already set, dso=/home/acme/bin/perf
      <SNIP>
      unwind: access_mem addr 0x7ffce6c48098 val 48563f, offset 1144
      unwind: test__dwarf_unwind:ip = 0x4a54e5 (0xa54e5)
      got: test__dwarf_unwind 0xa54e5, expecting test__dwarf_unwind
      unwind: '':ip = 0x4a50bb (0xa50bb)
      failed: got unresolved address 0xa50bb
      unwind failed
      test child finished with -1
      ---- end ----
      DWARF unwind: FAILED!
      #
    
    After:
    
      # perf test dwarf
      58: DWARF unwind                               : Ok
      # strip ~/bin/perf
      # perf test dwarf
      58: DWARF unwind                               : Ok
      #
      # perf test -v dwarf
      58: DWARF unwind                               :
      --- start ---
      test child forked, pid 7219
      unwind: thread map already set, dso=/home/acme/bin/perf
      <SNIP>
      unwind: access_mem addr 0x7fff007da2c8 val 48575f, offset 1144
      unwind: test__arch_unwind_sample:ip = 0x589044 (0x189044)
      got: test__arch_unwind_sample 0x189044, expecting test__arch_unwind_sample
      unwind: test_dwarf_unwind__thread:ip = 0x4a52f7 (0xa52f7)
      got: test_dwarf_unwind__thread 0xa52f7, expecting test_dwarf_unwind__thread
      unwind: test_dwarf_unwind__compare:ip = 0x4a5468 (0xa5468)
      got: test_dwarf_unwind__compare 0xa5468, expecting test_dwarf_unwind__compare
      unwind: bsearch:ip = 0x7f6608ae94d8 (0x394d8)
      got: bsearch 0x394d8, expecting bsearch
      unwind: test_dwarf_unwind__krava_3:ip = 0x4a54d1 (0xa54d1)
      got: test_dwarf_unwind__krava_3 0xa54d1, expecting test_dwarf_unwind__krava_3
      unwind: test_dwarf_unwind__krava_2:ip = 0x4a550b (0xa550b)
      got: test_dwarf_unwind__krava_2 0xa550b, expecting test_dwarf_unwind__krava_2
      unwind: test_dwarf_unwind__krava_1:ip = 0x4a554b (0xa554b)
      got: test_dwarf_unwind__krava_1 0xa554b, expecting test_dwarf_unwind__krava_1
      unwind: test__dwarf_unwind:ip = 0x4a5605 (0xa5605)
      got: test__dwarf_unwind 0xa5605, expecting test__dwarf_unwind
      test child finished with 0
      ---- end ----
      DWARF unwind: Ok
      #
    
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lkml.kernel.org/r/20180206181813.10943-17-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0607dd4d05ccff07c40e2c06c728afe7b60498cb
Author: Jiri Olsa <jolsa@redhat.com>
Date:   Fri Feb 16 13:36:19 2018 +0100

    perf report: Fix memory corruption in --branch-history mode --branch-history
    
    [ Upstream commit e3ebaa465136ecfedf9c6f4671df02bf625f8125 ]
    
    Jin Yao reported memory corrupton in perf report with
    branch info used for stack trace:
    
      > Following command lines will cause perf crash.
    
      > perf record -j call -g -a <application>
      > perf report --branch-history
      >
      > *** Error in `perf': double free or corruption (!prev): 0x00000000104aa040 ***
      > ======= Backtrace: =========
      > /lib/x86_64-linux-gnu/libc.so.6(+0x77725)[0x7f6b37254725]
      > /lib/x86_64-linux-gnu/libc.so.6(+0x7ff4a)[0x7f6b3725cf4a]
      > /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f6b37260abc]
      > perf[0x51b914]
      > perf(hist_entry_iter__add+0x1e5)[0x51f305]
      > perf[0x43cf01]
      > perf[0x4fa3bf]
      > perf[0x4fa923]
      > perf[0x4fd396]
      > perf[0x4f9614]
      > perf(perf_session__process_events+0x89e)[0x4fc38e]
      > perf(cmd_report+0x15d2)[0x43f202]
      > perf[0x4a059f]
      > perf(main+0x631)[0x427b71]
      > /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f6b371fd830]
      > perf(_start+0x29)[0x427d89]
    
    For the cumulative output, we allocate the he_cache array based on the
    --max-stack option value and populate it with data from 'callchain_cursor'.
    
    The --max-stack option value does not ensure now the limit for number of
    callchain_cursor nodes, so the cumulative iter code will allocate smaller array
    than it's actually needed and cause above corruption.
    
    I think the --max-stack limit does not apply here anyway, because we add
    callchain data as normal hist entries, while the --max-stack control the limit
    of single entry callchain depth.
    
    Using the callchain_cursor.nr as he_cache array count to fix this. Also
    removing struct hist_entry_iter::max_stack, because there's no longer any use
    for it.
    
    We need more fixes to ensure that the branch stack code follows properly the
    logic of --max-stack, which is not the case at the moment.
    
    Original-patch-by: Jin Yao <yao.jin@linux.intel.com>
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    Reported-by: Jin Yao <yao.jin@linux.intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kan Liang <kan.liang@intel.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lkml.kernel.org/r/20180216123619.GA9945@krava
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 25c73064c670c764d0c585142e2245ecb75a40a1
Author: Jiri Olsa <jolsa@kernel.org>
Date:   Thu Feb 15 13:26:35 2018 +0100

    perf tests: Use arch__compare_symbol_names to compare symbols
    
    [ Upstream commit ab6e9a99345131cd8e54268d1d0dc04a33f7ed11 ]
    
    The symbol search called by machine__find_kernel_symbol_by_name is using
    internally arch__compare_symbol_names function to compare 2 symbol
    names, because different archs have different ways of comparing symbols.
    Mostly for skipping '.' prefixes and similar.
    
    In test 1 when we try to find matching symbols in kallsyms and vmlinux,
    by address and by symbol name. When either is found we compare the pair
    symbol names  by simple strcmp, which is not good enough for reasons
    explained in previous paragraph.
    
    On powerpc this can cause lockup, because even thought we found the
    pair, the compared names are different and don't match simple strcmp.
    Following code path is executed, that leads to lockup:
    
       - we find the pair in kallsyms by sym->start
    next_pair:
       - we compare the names and it fails
       - we find the pair by sym->name
       - the pair addresses match so we call goto next_pair
         because we assume the names match in this case
    
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Fixes: 031b84c407c3 ("perf probe ppc: Enable matching against dot symbols automatically")
    Link: http://lkml.kernel.org/r/20180215122635.24029-10-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6a1ede55300998169f29f57b54602fe402fe1297
Author: Jin Yao <yao.jin@linux.intel.com>
Date:   Mon Jan 29 18:57:53 2018 +0800

    perf report: Fix wrong jump arrow
    
    [ Upstream commit b40982e8468b46b8f7f5bba5a7e541ec04a29d7d ]
    
    When we use perf report interactive annotate view, we can see
    the position of jump arrow is not correct. For example,
    
    1. perf record -b ...
    2. perf report
    3. In interactive mode, select Annotate 'function'
    
    Percent│ IPC Cycle
           │                                if (flag)
      1.37 │0.4┌──   1      ↓ je     82
           │   │                                    x += x / y + y / x;
      0.00 │0.4│  1310        movsd  (%rsp),%xmm0
      0.00 │0.4│   565        movsd  0x8(%rsp),%xmm4
           │0.4│              movsd  0x8(%rsp),%xmm1
           │0.4│              movsd  (%rsp),%xmm3
           │0.4│              divsd  %xmm4,%xmm0
      0.00 │0.4│   579        divsd  %xmm3,%xmm1
           │0.4│              movsd  (%rsp),%xmm2
           │0.4│              addsd  %xmm1,%xmm0
           │0.4│              addsd  %xmm2,%xmm0
      0.00 │0.4│              movsd  %xmm0,(%rsp)
           │   │                    volatile double x = 1212121212, y = 121212;
           │   │
           │   │                    s_randseed = time(0);
           │   │                    srand(s_randseed);
           │   │
           │   │                    for (i = 0; i < 2000000000; i++) {
      1.37 │0.4└─→      82:   sub    $0x1,%ebx
     28.21 │0.48    17      ↑ jne    38
    
    The jump arrow in above example is not correct. It should add the
    width of IPC and Cycle.
    
    With this patch, the result is:
    
    Percent│ IPC Cycle
           │                                if (flag)
      1.37 │0.48     1     ┌──je     82
           │               │                        x += x / y + y / x;
      0.00 │0.48  1310     │  movsd  (%rsp),%xmm0
      0.00 │0.48   565     │  movsd  0x8(%rsp),%xmm4
           │0.48           │  movsd  0x8(%rsp),%xmm1
           │0.48           │  movsd  (%rsp),%xmm3
           │0.48           │  divsd  %xmm4,%xmm0
      0.00 │0.48   579     │  divsd  %xmm3,%xmm1
           │0.48           │  movsd  (%rsp),%xmm2
           │0.48           │  addsd  %xmm1,%xmm0
           │0.48           │  addsd  %xmm2,%xmm0
      0.00 │0.48           │  movsd  %xmm0,(%rsp)
           │               │        volatile double x = 1212121212, y = 121212;
           │               │
           │               │        s_randseed = time(0);
           │               │        srand(s_randseed);
           │               │
           │               │        for (i = 0; i < 2000000000; i++) {
      1.37 │0.48        82:└─→sub    $0x1,%ebx
     28.21 │0.48    17      ↑ jne    38
    
    Committer notes:
    
    Please note that only from LBRv5 (according to Jiri) onwards, i.e. >=
    Skylake is that we'll have the cycles counts in each branch record
    entry, so to see the Cycles and IPC columns, and be able to test this
    patch, one need a capable hardware.
    
    While applying this I first tested it on a Broadwell class machine and
    couldn't get those columns, will add code to the annotate browser to
    warn the user about that, i.e. you have branch records, but no cycles,
    use a more recent hardware to get the cycles and IPC columns.
    
    Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Jin Yao <yao.jin@intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kan Liang <kan.liang@intel.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lkml.kernel.org/r/1517223473-14750-1-git-send-email-yao.jin@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9147c4221d00f0d833811137abe4d45921a55542
Author: Thomas Richter <tmricht@linux.vnet.ibm.com>
Date:   Wed Feb 14 08:03:03 2018 +0100

    perf test: Fix test case inet_pton to accept inlines.
    
    [ Upstream commit 0f19a038afdc592176c9a302f0d08be6a68ad74a ]
    
    Using Fedora 27 and latest Linux kernel the test case
    trace+probe_libc_inet_pton.sh fails again on s390.  This time is the
    inlining of functions which does not match.  After an update of the
    glibc (from 2.26-16 to 2.26-24) the output is different
    
    The expected output is:
    
                 __inet_pton (/usr/lib64/libc-2.26.so)
                 gaih_inet (inlined)
                 ....
    
    The actual output is:
    
      1 packets transmitted, 1 received, 0% packet loss, time 0ms
      rtt min/avg/max/mdev = 0.061/0.061/0.061/0.000 ms
           0.000 probe_libc:inet_pton:(3ffb2140448))
                 __inet_pton (inlined)
                 gaih_inet.constprop.7 (/usr/lib64/libc-2.26.so)
                 ...
    
    Fix this by being less strict on 'inlined' verses library name and
    accept both
    
    Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
    Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
    Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
    Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
    Link: http://lkml.kernel.org/r/20180214070303.55757-1-tmricht@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0f237909f585abb958a1b8a5ba7d7e682d26dc56
Author: Baoquan He <bhe@redhat.com>
Date:   Wed Feb 14 13:46:56 2018 +0800

    x86/apic: Set up through-local-APIC mode on the boot CPU if 'noapic' specified
    
    [ Upstream commit bee3204ec3c49f6f53add9c3962c9012a5c036fa ]
    
    Currently the kdump kernel becomes very slow if 'noapic' is specified.
    Normal kernel doesn't have this bug.
    
    Kernel parameter 'noapic' is used to disable IO-APIC in system for
    testing or special purpose. Here the root cause is that in kdump
    kernel LAPIC is disabled since commit:
    
      522e664644 ("x86/apic: Disable I/O APIC before shutdown of the local APIC")
    
    In this case we need set up through-local-APIC on boot CPU in
    setup_local_APIC().
    
    In normal kernel the legacy irq mode is enabled by the BIOS. If
    it is virtual wire mode, the local-APIC has been enabled and set as
    through-local-APIC.
    
    Though we fixed the regression introduced by commit 522e664644,
    to further improve robustness set up the through-local-APIC mode
    explicitly, do not rely on the default boot IRQ mode.
    
    Signed-off-by: Baoquan He <bhe@redhat.com>
    Reviewed-by: Eric W. Biederman <ebiederm@xmission.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: douly.fnst@cn.fujitsu.com
    Cc: joro@8bytes.org
    Cc: prarit@redhat.com
    Cc: uobergfe@redhat.com
    Link: http://lkml.kernel.org/r/20180214054656.3780-7-bhe@redhat.com
    [ Rewrote the changelog. ]
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5cce4275056eae4078f8444d0d4a3f33d6edaec5
Author: Ørjan Eide <orjan.eide@arm.com>
Date:   Tue Jan 30 21:28:33 2018 +0100

    drm/rockchip: Respect page offset for PRIME mmap calls
    
    [ Upstream commit 57de50af162b67612da99207b061ade3239e57db ]
    
    When mapping external DMA-bufs through the PRIME mmap call, we might be
    given an offset which has to be respected. However for the internal DRM
    GEM mmap path, we have to ignore the fake mmap offset used to identify
    the buffer only. Currently the code always zeroes out vma->vm_pgoff,
    which breaks the former.
    
    This patch fixes the problem by moving the vm_pgoff assignment to a
    function that is used only for GEM mmap path, so that the PRIME path
    retains the original offset.
    
    Cc: Daniel Kurtz <djkurtz@chromium.org>
    Signed-off-by: Ørjan Eide <orjan.eide@arm.com>
    Signed-off-by: Tomasz Figa <tfiga@chromium.org>
    Signed-off-by: Sean Paul <seanpaul@chromium.org>
    Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
    Tested-by: Heiko Stuebner <heiko@sntech.de>
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20180130202913.28724-4-thierry.escande@collabora.com
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b76f55b38d736bb4250a1065166e6a3667f1d8a1
Author: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date:   Fri Feb 16 23:09:48 2018 +0300

    soc: renesas: r8a77970-sysc: fix power area parents
    
    [ Upstream commit 40d5c8e94751f4a4fa4e0e27e3805e201a4e79c0 ]
    
    According to the figure 9.2(b) of the R-Car Series, 3rd Generation User’s
    Manual: Hardware Rev. 0.80 the A2IRn and A2SCn power areas in R8A77970 have
    the A3IR area as a parent, thus the SYSC driver has those parents wrong...
    
    Fixes: bab9b2a74fe9 ("soc: renesas: rcar-sysc: add R8A77970 support")
    Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
    Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4a3022a6c711a547200d9c2c519286d37e6421d2
Author: Joe Perches <joe@perches.com>
Date:   Tue Dec 5 23:04:58 2017 -0800

    MIPS: Octeon: Fix logging messages with spurious periods after newlines
    
    [ Upstream commit db6775ca6e0353d2618ca7d5e210fc36ad43bbd4 ]
    
    Using a period after a newline causes bad output.
    
    Fixes: 64b139f97c01 ("MIPS: OCTEON: irq: add CIB and other fixes")
    Signed-off-by: Joe Perches <joe@perches.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17886/
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 48463d5939562e9924da08f21536a75f75f49026
Author: Jake Moroni <mail@jakemoroni.com>
Date:   Sun Feb 18 15:26:04 2018 -0500

    dpaa_eth: fix pause capability advertisement logic
    
    [ Upstream commit 3021efb440d02bf5b952b6d151c7ffee9bdd49fe ]
    
    The ADVERTISED_Asym_Pause bit was being improperly set when both
    rx and tx pause were enabled. When rx and tx are both enabled, only
    the ADVERTISED_Pause bit is supposed to be set.
    
    Signed-off-by: Jake Moroni <mail@jakemoroni.com>
    Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 944fc3fe9c0ca62052670975f366fd87e12c3675
Author: Tao <xtao@amd.com>
Date:   Thu Feb 8 16:04:25 2018 -0500

    drm/amd/display: Set vsc pack revision when DPCD revision is >= 1.2
    
    [ Upstream commit 3b94a4007dcfd4ac5780cd3d8a2d99979c966073 ]
    
    Brightness couldn't change when booting up in DC mode.
    It was because "psr_enabled" flag was not set to true before
    setting vsc packet revision, causing packet rev setup was skipped.
    Now instead of checking the psr flag, it checks if the DPCD_REV >= 1.2
    and set the vsc packet revision.
    
    Signed-off-by: Tao <xtao@amd.com>
    Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
    Acked-by: Harry Wentland <harry.wentland@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 23da937fa0a0ae162077dadc9430484bb761b599
Author: Archit Taneja <architt@codeaurora.org>
Date:   Wed Jan 17 15:04:46 2018 +0530

    dt-bindings: display: msm/dsi: Fix the PHY regulator supply props
    
    [ Upstream commit 8c4905fd4939c59e0f7993ba34883e328eef4b59 ]
    
    The PHY regulator supply names vary across different PHY versions.
    Mention explicitly which PHYs require which supplies.
    
    Cc: Rob Herring <robh@kernel.org>
    Cc: devicetree@vger.kernel.org
    Signed-off-by: Archit Taneja <architt@codeaurora.org>
    Reviewed-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Rob Clark <robdclark@gmail.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 926eef7405af6166cc756e70657107bb1aa708bc
Author: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Date:   Fri Feb 16 15:25:03 2018 +0100

    pinctrl: sh-pfc: r8a7796: Fix MOD_SEL register pin assignment for SSI pins group
    
    [ Upstream commit b418c4609d5052d174668ad6d13efe023c45c595 ]
    
    This patch fixes MOD_SEL1 bit20 and MOD_SEL2 bit20, bit21 pin assignment
    for SSI pins group.
    
    This is a correction to the incorrect implementation of MOD_SEL register
    pin assignment for R8A7796 SoC specification of R-Car Gen3 Hardware
    User's Manual Rev.0.51E or later.
    
    Fixes: f9aece7344bd ("pinctrl: sh-pfc: Initial R8A7796 PFC support")
    Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
    Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
    Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d1d597a9ce342a48fc7fafda928308b9ffe67982
Author: Tejun Heo <tj@kernel.org>
Date:   Tue Jan 9 10:38:17 2018 -0800

    rcu: Call touch_nmi_watchdog() while printing stall warnings
    
    [ Upstream commit 3caa973b7a260e7a2a69edc94c300ab9c65148c3 ]
    
    When RCU stall warning triggers, it can print out a lot of messages
    while holding spinlocks.  If the console device is slow (e.g. an
    actual or IPMI serial console), it may end up triggering NMI hard
    lockup watchdog like the following.

commit e75b0cc0c92e996ac3418bd4147644c9d4f440c0
Author: Niklas Cassel <niklas.cassel@axis.com>
Date:   Mon Feb 19 18:11:13 2018 +0100

    net: stmmac: call correct function in stmmac_mac_config_rx_queues_routing()
    
    [ Upstream commit 13138de01400762f706c5e956e70660770d61962 ]
    
    stmmac_mac_config_rx_queues_routing() incorrectly calls rx_queue_prio()
    instead of rx_queue_routing().
    
    This looks like a copy paste issue, since
    stmmac_mac_config_rx_queues_prio() already calls rx_queue_prio(),
    and both stmmac_mac_config_rx_queues_routing() and
    stmmac_mac_config_rx_queues_prio() are very similar in structure.
    
    Fixes: abe80fdc6ee6 ("net: stmmac: RX queue routing configuration")
    Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b1690fa89e827d867e855f21cc16e51a12131d3c
Author: Richard Guy Briggs <rgb@redhat.com>
Date:   Wed Feb 21 04:30:07 2018 -0500

    audit: return on memory error to avoid null pointer dereference
    
    [ Upstream commit 23138ead270045f1b3e912e667967b6094244999 ]
    
    If there is a memory allocation error when trying to change an audit
    kernel feature value, the ignored allocation error will trigger a NULL
    pointer dereference oops on subsequent use of that pointer.  Return
    instead.
    
    Passes audit-testsuite.
    See: https://github.com/linux-audit/audit-kernel/issues/76
    
    Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
    [PM: not necessary (other funcs check for NULL), but a good practice]
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 642faadfcd5ff474819de30af0cfd04740edb369
Author: Stefan Wahren <stefan.wahren@i2se.com>
Date:   Mon Feb 12 21:11:36 2018 +0100

    hwrng: bcm2835 - Handle deferred clock properly
    
    [ Upstream commit 7b4c5d30d0bd2b22c09d4d993a76e0973a873891 ]
    
    In case the probe of the clock is deferred, we would assume it is
    optional. This is wrong, so defer the probe of this driver until
    the clock is available.
    
    Fixes: 791af4f4907a ("hwrng: bcm2835 - Manage an optional clock")
    Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
    Acked-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ff3745d0b7839b64f41f0d03ebbbecbdeed0c010
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Wed Feb 21 13:24:16 2018 +0100

    PCMCIA / PM: Avoid noirq suspend aborts during suspend-to-idle
    
    [ Upstream commit dbdd0f58fd2cdde5cf945c9da67a2d52d32ba550 ]
    
    There is a problem with PCMCIA system resume callbacks with respect
    to suspend-to-idle in which the ->suspend_noirq() callback may be
    invoked after the ->resume_noirq() one without resuming the system
    entirely in some cases.  This doesn't work for PCMCIA because of
    the lack of symmetry between its system suspend and system resume
    "noirq" callbacks.
    
    The system resume handling in PCMCIA is split between
    socket_early_resume() and socket_late_resume() which are called in
    different phases of system resume and both need to run for
    socket_suspend() (invoked by the system suspend "noirq" callback)
    to work.  Specifically, socket_suspend() returns an error when
    called after socket_early_resume() without socket_late_resume(),
    so if the suspend-to-idle core detects a spurious wakeup event and
    attempts to put the system back to sleep, that is aborted by the
    error coming from socket_suspend().
    
    Avoid that by using a new socket state flag, SOCKET_IN_RESUME,
    to indicate that socket_early_resume() has already run for the
    socket in which case socket_suspend() will do minimum handling
    and return 0.
    
    This change has been tested on my venerable Toshiba Portege R500
    (which is where the problem has been discovered in the first place),
    but admittedly I have no PCMCIA cards to test along with the socket
    itself.
    
    Fixes: 33e4f80ee69b (ACPI / PM: Ignore spurious SCI wakeups from suspend-to-idle)
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [linux@dominikbrodowski.net: follow same codepaths for both suspend variants; call ->suspend()]
    Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0784a3444b1972101483f98fef79bddf3bbe9ac1
Author: Henry Zhang <henryzhang62@gmail.com>
Date:   Wed Jan 17 18:41:33 2018 -0800

    ARM: dts: bcm283x: Fix pin function of JTAG pins
    
    [ Upstream commit 1a012cb2569f2031b3636232c3ab21c20c92d281 ]
    
    BCM2835 ARM Peripherals doc shows gpio pins 4, 5, 6, 12 and 13
    carry altenate function, ALT5 for ARM JTAG
    
    Fixes: 21ff843931b2 ("ARM: dts: bcm283x: Define standard pinctrl groups in the gpio node.")
    
    Signed-off-by: Henry Zhang <henryzhang62@gmail.com>
    Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
    Signed-off-by: Eric Anholt <eric@anholt.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5e776b2cb757a9d23f40236fcaf2765d193491e1
Author: Stefan Wahren <stefan.wahren@i2se.com>
Date:   Fri Feb 16 11:55:34 2018 +0100

    ARM: dts: bcm283x: Fix probing of bcm2835-i2s
    
    [ Upstream commit 79c81facdc0b43b1cef37b8d5689a8c8b78f8be0 ]
    
    Since 517e7a1537a ("ASoC: bcm2835: move to use the clock framework")
    the bcm2835-i2s requires a clock as DT property. Unfortunately
    the necessary DT change has never been applied. While we are at it
    also fix the first PCM register range to cover the PCM_GRAY register.
    
    Fixes: 517e7a1537a ("ASoC: bcm2835: move to use the clock framework")
    Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>
    Tested-by: Matthias Reichl <hias@horus.com>
    Signed-off-by: Eric Anholt <eric@anholt.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 653b1593580a0402e38ffb132b79e3ee83879670
Author: Ladislav Michl <ladis@linux-mips.org>
Date:   Thu Feb 22 18:21:36 2018 +0100

    power: supply: ltc2941-battery-gauge: Fix temperature units
    
    [ Upstream commit dde5953f05a89eb63a0d666ffe51d447b2ac3e05 ]
    
    Temperature is measured in tenths of degree Celsius.
    
    Fixes: 085bc24d1553 ("Add LTC2941/LTC2943 Battery Gauge Driver")
    Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
    Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 03e07739d14d8e2f7ca0e6467a4c8bfe962cb0ad
Author: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date:   Sat Feb 24 22:41:45 2018 +0300

    sh_eth: fix TSU init on SH7734/R8A7740
    
    [ Upstream commit a94cf2a614f8bc5b2b33c708626ce695bf71e424 ]
    
    It appears that the single port Ether controllers having TSU (like SH7734/
    R8A7740) need the same kind of treating in sh_eth_tsu_init() as R7S72100
    currently has -- they also don't have the TSU registers related e.g. to
    passing the frames between ports. Add the 'sh_eth_cpu_data::dual_port'
    flag and use it as a new criterion for taking a "short path" in the TSU
    init sequence in order to avoid writing to the non-existent registers...
    
    Fixes: f0e81fecd4f8 ("net: sh_eth: Add support SH7734")
    Fixes: 73a0d907301e ("net: sh_eth: add support R8A7740")
    Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
    Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6d4563e3382157a3e49e216ca3e1d104869d08d7
Author: Jacob Keller <jacob.e.keller@intel.com>
Date:   Mon Jan 29 15:57:48 2018 -0800

    ixgbe: prevent ptp_rx_hang from running when in FILTER_ALL mode
    
    [ Upstream commit 6704a3abf4cf4181a1ee64f5db4969347b88ca1d ]
    
    On hardware which supports timestamping all packets, the timestamps are
    recorded in the packet buffer, and the driver no longer uses or reads
    the registers. This makes the logic for checking and clearing Rx
    timestamp hangs meaningless.
    
    If we run the ixgbe_ptp_rx_hang() function in this case, then the driver
    will continuously spam the log output with "Clearing Rx timestamp hang".
    These messages are spurious, and confusing to end users.
    
    The original code in commit a9763f3cb54c ("ixgbe: Update PTP to support
    X550EM_x devices", 2015-12-03) did have a flag PTP_RX_TIMESTAMP_IN_REGISTER
    which was intended to be used to avoid the Rx timestamp hang check,
    however it did not actually check the flag before calling the function.
    
    Do so now in order to stop the checks and prevent the spurious log
    messages.
    
    Fixes: a9763f3cb54c ("ixgbe: Update PTP to support X550EM_x devices", 2015-12-03)
    Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
    Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8382e33e3446705b5c6175c16bab1e780befab02
Author: Jan Kara <jack@suse.cz>
Date:   Thu Feb 22 10:39:52 2018 +0100

    udf: Provide saner default for invalid uid / gid
    
    [ Upstream commit 116e5258e4115aca0c64ac0bf40ded3b353ed626 ]
    
    Currently when UDF filesystem is recorded without uid / gid (ids are set
    to -1), we will assign INVALID_[UG]ID to vfs inode unless user uses uid=
    and gid= mount options. In such case filesystem could not be modified in
    any way as VFS refuses to modify files with invalid ids (even by root).
    This is confusing to users and not very useful default since such media
    mode is generally used for removable media. Use overflow[ug]id instead
    so that at least root can modify the filesystem.
    
    Reported-by: Steve Kenton <skenton@ou.edu>
    Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d81cc2704e4536b3a56e607567bf4f9449715c1d
Author: Thomas Vincent-Cross <me@tvc.id.au>
Date:   Tue Feb 27 20:20:36 2018 +1100

    PCI: Add function 1 DMA alias quirk for Marvell 88SE9220
    
    [ Upstream commit 832e4e1f76b8a84991e9db56fdcef1ebce839b8b ]
    
    Add Marvell 88SE9220 DMA quirk as found and tested on bug 42679.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=42679
    Signed-off-by: Thomas Vincent-Cross <me@tvc.id.au>
    Signed-off-by: Bjorn Helgaas <helgaas@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d4d16da52e9f3fd0e82f66ac5a5034b2fde691dc
Author: Madalin Bucur <madalin.bucur@nxp.com>
Date:   Mon Feb 26 11:24:01 2018 -0600

    dpaa_eth: fix SG mapping
    
    [ Upstream commit 120d75ecf043044554abbba8507f6d22e4715beb ]
    
    An issue in the code mapping the skb fragments into
    scatter-gather frames was evidentiated by netperf
    TCP_SENDFILE tests. The size was set wrong for all
    fragments but the first, affecting the transmission
    of any skb with more than one fragment.
    
    Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ff30fd0316f6dec9aab6af794402e1363444952e
Author: Viresh Kumar <viresh.kumar@linaro.org>
Date:   Thu Feb 22 11:29:43 2018 +0530

    cpufreq: Reorder cpufreq_online() error code path
    
    [ Upstream commit b24b6478e65f140610ab1ffaadc7bc6bf0be8aad ]
    
    Ideally the de-allocation of resources should happen in the exact
    opposite order in which they were allocated. It helps maintain the code
    in long term, even if nothing really breaks with incorrect ordering.
    
    That wasn't followed in cpufreq_online() and it has some
    inconsistencies.  For example, the symlinks were created from within
    the locked region while they are removed only after putting the locks.
    Also ->exit() should have been called only after the symlinks are
    removed and the lock is dropped, as that was the case when ->init()
    was first called.
    
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    [ rjw: Subject ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit afca25f2057420f3be9ad9d1fa569d9850906672
Author: Niklas Cassel <niklas.cassel@axis.com>
Date:   Mon Feb 26 22:47:06 2018 +0100

    net: stmmac: ensure that the MSS desc is the last desc to set the own bit
    
    [ Upstream commit 15d2ee42a3087089e73ad52fd8c1b37ab496b87c ]
    
    A dma_wmb() is used to guarantee the ordering, with respect to
    other writes, to cache coherent DMA memory.
    
    There is a dma_wmb() in prepare_tx_desc()/prepare_tso_tx_desc() which
    ensures that TDES0/1/2 is written before TDES3 (which contains the own
    bit), for First Desc.
    
    However, in the rare case that MSS changes, there will be a MSS
    context descriptor in front of the regular DMA descriptors:
    
    <MSS desc> <- DMA Next Descriptor
    <First Desc>
    <desc n>
    <Last Desc>
    
    Thus, for this special case, we need a dma_wmb()
    after prepare_tso_tx_desc()/before writing the own bit to the MSS desc,
    so that we flush the write to TDES3 for First Desc,
    in order to ensure that the MSS descriptor is the last descriptor to
    set the own bit.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3c945028b7bac1dc94767e6b1820d69299935844
Author: Niklas Cassel <niklas.cassel@axis.com>
Date:   Mon Feb 26 22:47:08 2018 +0100

    net: stmmac: ensure that the device has released ownership before reading data
    
    [ Upstream commit a6b25da5e7ba212af5826a662e6a035a79bffabd ]
    
    According to Documentation/memory-barriers.txt, we need to use a
    dma_rmb() after reading the status/own bit, to ensure that all
    descriptor fields are read after reading the own bit.
    
    This way, we ensure that the DMA engine is done with the DMA
    descriptor before we read the other descriptor fields, e.g. reading
    the tx hardware timestamp (if PTP is enabled).
    
    Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1c66cfc6cb54a25cf67ddfe44d0912c457aede45
Author: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date:   Mon Feb 26 18:10:56 2018 -0600

    ibmvnic: Allocate statistics buffers during probe
    
    [ Upstream commit 53cc7721fdf12e649994cfb7d8f562acb0e4510b ]
    
    Currently, buffers holding individual queue statistics are allocated
    when the device is opened. If an ibmvnic interface is hotplugged or
    initialized but never opened, an attempt to get statistics with
    ethtool will result in a kernel panic.
    
    Since the driver allocates a constant number, the maximum supported
    queues, of buffers, these can be allocated during device probe and
    freed when the device is hot-unplugged or the module is removed.
    
    Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f65122de0d3a8f243543108fdd2a0bba7fc02122
Author: Monk Liu <Monk.Liu@amd.com>
Date:   Tue Jan 23 18:26:20 2018 +0800

    drm/amdgpu: adjust timeout for ib_ring_tests(v2)
    
    [ Upstream commit dbf797655a43c6318ebb90b899e6583fcadc6472 ]
    
    issue:
    sometime GFX/MM ib test hit timeout under SRIOV env, root cause
    is that engine doesn't come back soon enough so the current
    IB test considered as timed out.
    
    fix:
    for SRIOV GFX IB test wait time need to be expanded a lot during
    SRIOV runtimei mode since it couldn't really begin before GFX engine
    come back.
    
    for SRIOV MM IB test it always need more time since MM scheduling
    is not go together with GFX engine, it is controled by h/w MM
    scheduler so no matter runtime or exclusive mode MM IB test
    always need more time.
    
    v2:
    use ring type instead of idx to judge
    
    Signed-off-by: Monk Liu <Monk.Liu@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2a87e7f31050550a3d001dfc2aeaea60351540a9
Author: Monk Liu <Monk.Liu@amd.com>
Date:   Mon Jan 29 19:24:32 2018 +0800

    drm/amdgpu: disable GFX ring and disable PQ wptr in hw_fini
    
    [ Upstream commit 9f0178fb67699992d38601cb923b434f9986dd68 ]
    
    otherwise there will be DMAR reading error comes out from CP since
    GFX is still alive and CPC's WPTR_POLL is still enabled, which would
    lead to DMAR read error.
    
    fix:
    we can hault CPG after hw_fini, but cannot halt CPC becaues KIQ
    stil need to be alive to let RLCV invoke, but its WPTR_POLL could
    be disabled.
    
    Signed-off-by: Monk Liu <Monk.Liu@amd.com>
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2e6ad124dbeed3994b270b80b4b881eee24ab99c
Author: Ravikumar Kattekola <rk@ti.com>
Date:   Tue Feb 6 18:28:02 2018 +0530

    ARM: dts: dra71-evm: Correct evm_sd regulator max voltage
    
    [ Upstream commit f4aa1bd5b4fc80f5f4ecd184caad832fd62c25f7 ]
    
    Correct vpo_sd_1v8_3v3 regulator max voltage to 3.3V
    
    Fixes: 9868bc585ae2 ("ARM: dts: Add support for dra718-evm")
    Signed-off-by: Ravikumar Kattekola <rk@ti.com>
    Signed-off-by: Sekhar Nori <nsekhar@ti.com>
    Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
    Signed-off-by: Tony Lindgren <tony@atomide.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9e279ef189c31a9d819df2875253910708e2478c
Author: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date:   Sun Feb 11 15:07:44 2018 +0200

    drm: omapdrm: dss: Move initialization code from component bind to probe
    
    [ Upstream commit 215003b4ae1d47035092fef73b6a22aa82037091 ]
    
    There's no reason to delay initialization of most of the driver (such as
    mapping memory I/O, getting clocks or enabling runtime PM) to the
    component master bind handler.
    
    This additionally fixes a real PM issue caused enabling runtime PM in
    the bind handler.
    
    The bind handler performs the following sequence of PM operations:
    
            pm_runtime_enable(dev);
            pm_runtime_get_sync(dev);
    
            ... (access the hardware to read the device revision) ...
    
            pm_runtime_put_sync(dev);
    
    If a failure occurs at this point, the error path calls
    pm_runtime_disable() to balance the pm_runtime_enable() call.
    
    To understand the problem, it should be noted that the bind handler is
    called when one of the component registers itself, which happens in the
    component's probe handler. Furthermore, as the components are children
    of the DSS, the device core calls pm_runtime_get_sync() on the DSS
    platform device before calling the component's probe handler. This
    increases the DSS power usage count but doesn't runtime resume the
    device, as runtime PM is disabled at that point.
    
    The bind handler is thus called with runtime PM disabled, with the
    device runtime suspended, but with the power usage count larger than 0.
    The pm_runtime_get_sync() call will thus further increase the power
    usage count and runtime resume the device. The pm_runtime_put_sync()
    handler will decrease the power usage count to a non-zero value and will
    thus not suspend the device. Finally, the pm_runtime_disable() call will
    disable runtime PM, preventing the pm_runtime_put() call in the device
    core from runtime suspending the device. The DSS device is thus left
    powered on.
    
    To fix this, move the initialization code from the bind handler to the
    probe handler.
    
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5e0986f7caf17d7b1acd2092975360bf8e88a57d
Author: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date:   Thu Feb 15 12:25:09 2018 +0000

    dmaengine: qcom: bam_dma: get num-channels and num-ees from dt
    
    [ Upstream commit 48d163b1aa6e7f650c0b7a4f9c61c387a6def868 ]
    
    When Linux is master of BAM, it can directly read registers to know number
    of supported channels, however when its remotely controlled reading these
    registers would trigger a crash if the BAM is not yet initialized or
    powered up on the remote side.
    
    This patch allows driver to read num-channels and num-ees from Device Tree
    for remotely controlled BAM.
    
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Signed-off-by: Vinod Koul <vinod.koul@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 41acdb3bc9fb093cf04bbc1bd5b32e88e419a318
Author: Cornelia Huck <cohuck@redhat.com>
Date:   Thu Feb 22 15:35:43 2018 +0100

    vfio-ccw: fence off transport mode
    
    [ Upstream commit 9851bc77e62499957567e7c39a5beba7d6de6296 ]
    
    vfio-ccw only supports command mode for channel programs, not transport
    mode. User space is supposed to already take care of that and pass us
    command-mode ORBs only, but better make sure and return an error to
    the caller instead of trying to process tcws as ccws.
    
    Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
    Acked-by: Halil Pasic <pasic@linux.vnet.ibm.com>
    Signed-off-by: Cornelia Huck <cohuck@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit aedc0aeeccbeb65d3ade0b7d11f89c34790642d8
Author: Niklas Cassel <niklas.cassel@axis.com>
Date:   Thu Feb 22 16:22:46 2018 +0100

    pinctrl: artpec6: dt: add missing pin group uart5nocts
    
    [ Upstream commit 7e065fb9ccce89fe667fdbd9a177eaec59a359fc ]
    
    Add missing pin group uart5nocts (all pins except cts), which has been
    supported by the artpec6 pinctrl driver since its initial submission.
    
    Fixes: 00df0582eab1 ("pinctrl: Add pincontrol driver for ARTPEC-6 SoC")
    Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
    Reviewed-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit eccaa66827a593da947290ed39b1cf1a898015f3
Author: Richard Fitzgerald <rf@opensource.cirrus.com>
Date:   Wed Feb 28 15:53:06 2018 +0000

    pinctrl: devicetree: Fix dt_to_map_one_config handling of hogs
    
    [ Upstream commit b89405b6102fcc3746f43697b826028caa94c823 ]
    
    When dt_to_map_one_config() is called with a pinctrl_dev passed
    in, it should only be using this if the node being looked up
    is a hog. The code was always using the passed pinctrl_dev
    without checking whether the dt node referred to it.
    
    A pin controller can have pinctrl-n dependencies on other pin
    controllers in these cases:
    
    - the pin controller hardware is external, for example I2C, so
      needs other pin controller(s) to be setup to communicate with
      the hardware device.
    
    - it is a child of a composite MFD so its of_node is shared with
      the parent MFD and other children of that MFD. Any part of that
      MFD could have dependencies on other pin controllers.
    
    Because of this, dt_to_map_one_config() can't assume that if it
    has a pinctrl_dev passed in then the node it looks up must be
    a hog. It could be a reference to some other pin controller.
    
    Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit be32188c74a4717181217f8138f2dc27380260e4
Author: lionel.debieve@st.com <lionel.debieve@st.com>
Date:   Thu Feb 15 14:03:08 2018 +0100

    hwrng: stm32 - add reset during probe
    
    [ Upstream commit 326ed382256475aa4b8b7eae8a2f60689fd25e78 ]
    
    Avoid issue when probing the RNG without
    reset if bad status has been detected previously
    
    Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3fcb377f385447526fafd572a0d3dd2ace1f92da
Author: Alexey Khoroshilov <khoroshilov@ispras.ru>
Date:   Sat Feb 10 13:17:27 2018 +0300

    watchdog: asm9260_wdt: fix error handling in asm9260_wdt_probe()
    
    [ Upstream commit 3c829f47e33eb0398a9a14e357a05199a7be0277 ]
    
    If devm_reset_control_get_exclusive() fails, asm9260_wdt_probe()
    returns immediately. But clks has been already enabled at that point,
    so it is required to disable them or to move the code around.
    
    Found by Linux Driver Verification project (linuxtesting.org).
    
    Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1933da10ce5c9c33ea958228ed3f6a68899e439b
Author: Govindarajulu Varadarajan <gvaradar@cisco.com>
Date:   Thu Mar 1 11:07:23 2018 -0800

    enic: enable rq before updating rq descriptors
    
    [ Upstream commit e8588e268509292550634d9a35f2723a207683b2 ]
    
    rq should be enabled before posting the buffers to rq desc. If not hw sees
    stale value and casuses DMAR errors.
    
    Signed-off-by: Govindarajulu Varadarajan <gvaradar@cisco.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 012efc6d8dbf14e84bfb6eb985cf764695d05ef5
Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Date:   Fri Feb 2 19:05:15 2018 +0900

    dmaengine: rcar-dmac: Check the done lists in rcar_dmac_chan_get_residue()
    
    [ Upstream commit 3e081628d510b2ddbe493371d9c574d9275da17e ]
    
    This patch fixes an issue that a race condition happens between a client
    driver and the rcar-dmac driver:
    
    - The rcar_dmac_isr_transfer_end() is called.
     - The done list appears, and desc.running is the next active list.
    - rcar_dmac_chan_get_residue() is called by a client driver before
      rcar_dmac_isr_channel_thread() is called.
     - The rcar_dmac_chan_get_residue() will not find any descriptors.
     - And, the following WARNING happens:
            WARN(1, "No descriptor for cookie!");
    
    The sh-sci driver with HSCIF (921,600bps) on R-Car H3 can cause this
    situation.
    So, this patch checks the done lists in rcar_dmac_chan_get_residue()
    and returns zero if the done lists has the argument cookie.
    
    Tested-by: Nguyen Viet Dung <dung.nguyen.aj@renesas.com>
    Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Signed-off-by: Vinod Koul <vinod.koul@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a8a10639e541759e57fe710da769b6288c610a28
Author: Christophe Leroy <christophe.leroy@c-s.fr>
Date:   Thu Feb 22 15:27:26 2018 +0100

    powerpc/mm/slice: Fix hugepage allocation at hint address on 8xx
    
    [ Upstream commit aa0ab02ba992eb956934b21373e0138211486ddd ]
    
    On the 8xx, the page size is set in the PMD entry and applies to
    all pages of the page table pointed by the said PMD entry.
    
    When an app has some regular pages allocated (e.g. see below) and tries
    to mmap() a huge page at a hint address covered by the same PMD entry,
    the kernel accepts the hint allthough the 8xx cannot handle different
    page sizes in the same PMD entry.
    
    10000000-10001000 r-xp 00000000 00:0f 2597 /root/malloc
    10010000-10011000 rwxp 00000000 00:0f 2597 /root/malloc
    
    mmap(0x10080000, 524288, PROT_READ|PROT_WRITE,
         MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0) = 0x10080000
    
    This results the app remaining forever in do_page_fault()/hugetlb_fault()
    and when interrupting that app, we get the following warning:
    
    [162980.035629] WARNING: CPU: 0 PID: 2777 at arch/powerpc/mm/hugetlbpage.c:354 hugetlb_free_pgd_range+0xc8/0x1e4
    [162980.035699] CPU: 0 PID: 2777 Comm: malloc Tainted: G W       4.14.6 #85
    [162980.035744] task: c67e2c00 task.stack: c668e000
    [162980.035783] NIP:  c000fe18 LR: c00e1eec CTR: c00f90c0
    [162980.035830] REGS: c668fc20 TRAP: 0700   Tainted: G W        (4.14.6)
    [162980.035854] MSR:  00029032 <EE,ME,IR,DR,RI>  CR: 24044224 XER: 20000000
    [162980.036003]
    [162980.036003] GPR00: c00e1eec c668fcd0 c67e2c00 00000010 c6869410 10080000 00000000 77fb4000
    [162980.036003] GPR08: ffff0001 0683c001 00000000 ffffff80 44028228 10018a34 00004008 418004fc
    [162980.036003] GPR16: c668e000 00040100 c668e000 c06c0000 c668fe78 c668e000 c6835ba0 c668fd48
    [162980.036003] GPR24: 00000000 73ffffff 74000000 00000001 77fb4000 100fffff 10100000 10100000
    [162980.036743] NIP [c000fe18] hugetlb_free_pgd_range+0xc8/0x1e4
    [162980.036839] LR [c00e1eec] free_pgtables+0x12c/0x150
    [162980.036861] Call Trace:
    [162980.036939] [c668fcd0] [c00f0774] unlink_anon_vmas+0x1c4/0x214 (unreliable)
    [162980.037040] [c668fd10] [c00e1eec] free_pgtables+0x12c/0x150
    [162980.037118] [c668fd40] [c00eabac] exit_mmap+0xe8/0x1b4
    [162980.037210] [c668fda0] [c0019710] mmput.part.9+0x20/0xd8
    [162980.037301] [c668fdb0] [c001ecb0] do_exit+0x1f0/0x93c
    [162980.037386] [c668fe00] [c001f478] do_group_exit+0x40/0xcc
    [162980.037479] [c668fe10] [c002a76c] get_signal+0x47c/0x614
    [162980.037570] [c668fe70] [c0007840] do_signal+0x54/0x244
    [162980.037654] [c668ff30] [c0007ae8] do_notify_resume+0x34/0x88
    [162980.037744] [c668ff40] [c000dae8] do_user_signal+0x74/0xc4
    [162980.037781] Instruction dump:
    [162980.037821] 7fdff378 81370000 54a3463a 80890020 7d24182e 7c841a14 712a0004 4082ff94
    [162980.038014] 2f890000 419e0010 712a0ff0 408200e0 <0fe00000> 54a9000a 7f984840 419d0094
    [162980.038216] ---[ end trace c0ceeca8e7a5800a ]---
    [162980.038754] BUG: non-zero nr_ptes on freeing mm: 1
    [162985.363322] BUG: non-zero nr_ptes on freeing mm: -1
    
    In order to fix this, this patch uses the address space "slices"
    implemented for BOOK3S/64 and enhanced to support PPC32 by the
    preceding patch.
    
    This patch modifies the context.id on the 8xx to be in the range
    [1:16] instead of [0:15] in order to identify context.id == 0 as
    not initialised contexts as done on BOOK3S
    
    This patch activates CONFIG_PPC_MM_SLICES when CONFIG_HUGETLB_PAGE is
    selected for the 8xx
    
    Alltough we could in theory have as many slices as PMD entries, the
    current slices implementation limits the number of low slices to 16.
    This limitation is not preventing us to fix the initial issue allthough
    it is suboptimal. It will be cured in a subsequent patch.
    
    Fixes: 4b91428699477 ("powerpc/8xx: Implement support of hugepages")
    Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
    Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c0e07c9f2c9027c52958c69b4799f2ba8c2e8f4b
Author: Christophe Leroy <christophe.leroy@c-s.fr>
Date:   Thu Feb 22 15:27:24 2018 +0100

    powerpc/mm/slice: Enhance for supporting PPC32
    
    commit db3a528db41caaa6dfd4c64e9f5efb1c81a80467 upstream.
    
    In preparation for the following patch which will fix an issue on
    the 8xx by re-using the 'slices', this patch enhances the
    'slices' implementation to support 32 bits CPUs.
    
    On PPC32, the address space is limited to 4Gbytes, hence only the low
    slices will be used.
    
    The high slices use bitmaps. As bitmap functions are not prepared to
    handle bitmaps of size 0, this patch ensures that bitmap functions
    are called only when SLICE_NUM_HIGH is not nul.
    
    Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
    Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 59f125ad95b14ce6d1489de73f08f0741d5400e5
Author: Christophe Leroy <christophe.leroy@c-s.fr>
Date:   Thu Feb 22 15:27:22 2018 +0100

    powerpc/mm/slice: create header files dedicated to slices
    
    commit a3286f05bc5a5bc7fc73a9783ec89de78fcd07f8 upstream.
    
    In preparation for the following patch which will enhance 'slices'
    for supporting PPC32 in order to fix an issue on hugepages on 8xx,
    this patch takes out of page*.h all bits related to 'slices' and put
    them into newly created slice.h header files.
    While common parts go into asm/slice.h, subarch specific
    parts go into respective books3s/64/slice.c and nohash/64/slice.c
    'slices'
    
    Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
    Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0ccfb3b677c2446143d4d1895032d32d64643cfe
Author: Christophe Leroy <christophe.leroy@c-s.fr>
Date:   Thu Feb 22 15:27:20 2018 +0100

    powerpc/mm/slice: Remove intermediate bitmap copy
    
    commit 326691ad4f179e6edc7eb1271e618dd673e4736d upstream.
    
    bitmap_or() and bitmap_andnot() can work properly with dst identical
    to src1 or src2. There is no need of an intermediate result bitmap
    that is copied back to dst in a second step.
    
    Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
    Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
    Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 574f7d53f55cd06c9945835e65944c266093d178
Author: Suman Anna <s-anna@ti.com>
Date:   Mon Mar 5 16:18:49 2018 -0800

    ARM: dts: keystone-k2e-clocks: Fix missing unit address separator
    
    [ Upstream commit 5a3a03905a433216f517babd0a343ae7265e9ca1 ]
    
    Commit 95d8b41c765b ("ARM: dts: keystone-k2e-clocks: Add missing unit
    name to clock nodes that have regs") fixed the unit names on various
    clock nodes but missed out adding the unit address separator on the
    clkhyperlink0 clock node. Fix the same.
    
    Fixes: 95d8b41c765b ("ARM: dts: keystone-k2e-clocks: Add missing unit name to clock nodes that have regs")
    Signed-off-by: Suman Anna <s-anna@ti.com>
    Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e2b814c1dd654b30be5b3a46b22d298de569079d
Author: Qi Hou <qi.hou@windriver.com>
Date:   Tue Mar 6 09:13:37 2018 +0800

    dmaengine: pl330: fix a race condition in case of threaded irqs
    
    [ Upstream commit a3ca831249ca8c4c226e4ceafee04e280152e59d ]
    
    When booting up with "threadirqs" in command line, all irq handlers of the DMA
    controller pl330 will be threaded forcedly. These threads will race for the same
    list, pl330->req_done.
    
    Before the callback, the spinlock was released. And after it, the spinlock was
    taken. This opened an race window where another threaded irq handler could steal
    the spinlock and be permitted to delete entries of the list, pl330->req_done.
    
    If the later deleted an entry that was still referred to by the former, there would
    be a kernel panic when the former was scheduled and tried to get the next sibling
    of the deleted entry.
    
    The scenario could be depicted as below:
    
      Thread: T1  pl330->req_done  Thread: T2
          |             |              |
          |          -A-B-C-D-         |
        Locked          |              |
          |             |           Waiting
        Del A           |              |
          |          -B-C-D-           |
        Unlocked        |              |
          |             |           Locked
        Waiting         |              |
          |             |            Del B
          |             |              |
          |           -C-D-         Unlocked
        Waiting         |              |
          |
        Locked
          |
       get C via B
          \
           - Kernel panic
    
    The kernel panic looked like as below:
    
    Unable to handle kernel paging request at virtual address dead000000000108
    pgd = ffffff8008c9e000
    [dead000000000108] *pgd=000000027fffe003, *pud=000000027fffe003, *pmd=0000000000000000
    Internal error: Oops: 96000044 [#1] PREEMPT SMP
    Modules linked in:
    CPU: 0 PID: 85 Comm: irq/59-66330000 Not tainted 4.8.24-WR9.0.0.12_standard #2
    Hardware name: Broadcom NS2 SVK (DT)
    task: ffffffc1f5cc3c00 task.stack: ffffffc1f5ce0000
    PC is at pl330_irq_handler+0x27c/0x390
    LR is at pl330_irq_handler+0x2a8/0x390
    pc : [<ffffff80084cb694>] lr : [<ffffff80084cb6c0>] pstate: 800001c5
    sp : ffffffc1f5ce3d00
    x29: ffffffc1f5ce3d00 x28: 0000000000000140
    x27: ffffffc1f5c530b0 x26: dead000000000100
    x25: dead000000000200 x24: 0000000000418958
    x23: 0000000000000001 x22: ffffffc1f5ccd668
    x21: ffffffc1f5ccd590 x20: ffffffc1f5ccd418
    x19: dead000000000060 x18: 0000000000000001
    x17: 0000000000000007 x16: 0000000000000001
    x15: ffffffffffffffff x14: ffffffffffffffff
    x13: ffffffffffffffff x12: 0000000000000000
    x11: 0000000000000001 x10: 0000000000000840
    x9 : ffffffc1f5ce0000 x8 : ffffffc1f5cc3338
    x7 : ffffff8008ce2020 x6 : 0000000000000000
    x5 : 0000000000000000 x4 : 0000000000000001
    x3 : dead000000000200 x2 : dead000000000100
    x1 : 0000000000000140 x0 : ffffffc1f5ccd590
    
    Process irq/59-66330000 (pid: 85, stack limit = 0xffffffc1f5ce0020)
    Stack: (0xffffffc1f5ce3d00 to 0xffffffc1f5ce4000)
    3d00: ffffffc1f5ce3d80 ffffff80080f09d0 ffffffc1f5ca0c00 ffffffc1f6f7c600
    3d20: ffffffc1f5ce0000 ffffffc1f6f7c600 ffffffc1f5ca0c00 ffffff80080f0998
    3d40: ffffffc1f5ce0000 ffffff80080f0000 0000000000000000 0000000000000000
    3d60: ffffff8008ce202c ffffff8008ce2020 ffffffc1f5ccd668 ffffffc1f5c530b0
    3d80: ffffffc1f5ce3db0 ffffff80080f0d70 ffffffc1f5ca0c40 0000000000000001
    3da0: ffffffc1f5ce0000 ffffff80080f0cfc ffffffc1f5ce3e20 ffffff80080bf4f8
    3dc0: ffffffc1f5ca0c80 ffffff8008bf3798 ffffff8008955528 ffffffc1f5ca0c00
    3de0: ffffff80080f0c30 0000000000000000 0000000000000000 0000000000000000
    3e00: 0000000000000000 0000000000000000 0000000000000000 ffffff80080f0b68
    3e20: 0000000000000000 ffffff8008083690 ffffff80080bf420 ffffffc1f5ca0c80
    3e40: 0000000000000000 0000000000000000 0000000000000000 ffffff80080cb648
    3e60: ffffff8008b1c780 0000000000000000 0000000000000000 ffffffc1f5ca0c00
    3e80: ffffffc100000000 ffffff8000000000 ffffffc1f5ce3e90 ffffffc1f5ce3e90
    3ea0: 0000000000000000 ffffff8000000000 ffffffc1f5ce3eb0 ffffffc1f5ce3eb0
    3ec0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3ee0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3f00: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3f20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3f40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3f60: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3f80: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3fa0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3fc0: 0000000000000000 0000000000000005 0000000000000000 0000000000000000
    3fe0: 0000000000000000 0000000000000000 0000000275ce3ff0 0000000275ce3ff8
    Call trace:
    Exception stack(0xffffffc1f5ce3b30 to 0xffffffc1f5ce3c60)
    3b20:                                   dead000000000060 0000008000000000
    3b40: ffffffc1f5ce3d00 ffffff80084cb694 0000000000000008 0000000000000e88
    3b60: ffffffc1f5ce3bb0 ffffff80080dac68 ffffffc1f5ce3b90 ffffff8008826fe4
    3b80: 00000000000001c0 00000000000001c0 ffffffc1f5ce3bb0 ffffff800848dfcc
    3ba0: 0000000000020000 ffffff8008b15ae4 ffffffc1f5ce3c00 ffffff800808f000
    3bc0: 0000000000000010 ffffff80088377f0 ffffffc1f5ccd590 0000000000000140
    3be0: dead000000000100 dead000000000200 0000000000000001 0000000000000000
    3c00: 0000000000000000 ffffff8008ce2020 ffffffc1f5cc3338 ffffffc1f5ce0000
    3c20: 0000000000000840 0000000000000001 0000000000000000 ffffffffffffffff
    3c40: ffffffffffffffff ffffffffffffffff 0000000000000001 0000000000000007
    [<ffffff80084cb694>] pl330_irq_handler+0x27c/0x390
    [<ffffff80080f09d0>] irq_forced_thread_fn+0x38/0x88
    [<ffffff80080f0d70>] irq_thread+0x140/0x200
    [<ffffff80080bf4f8>] kthread+0xd8/0xf0
    [<ffffff8008083690>] ret_from_fork+0x10/0x40
    Code: f2a00838 f9405763 aa1c03e1 aa1503e0 (f9000443)
    ---[ end trace f50005726d31199c ]---
    Kernel panic - not syncing: Fatal exception in interrupt
    SMP: stopping secondary CPUs
    SMP: failed to stop secondary CPUs 0-1
    Kernel Offset: disabled
    Memory Limit: none
    ---[ end Kernel panic - not syncing: Fatal exception in interrupt
    
    To fix this, re-start with the list-head after dropping the lock then
    re-takeing it.
    
    Reviewed-by: Frank Mori Hess <fmh6jj@gmail.com>
    Tested-by: Frank Mori Hess <fmh6jj@gmail.com>
    Signed-off-by: Qi Hou <qi.hou@windriver.com>
    Signed-off-by: Vinod Koul <vinod.koul@intel.com>
    
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4ae82883d81d3a1541e60a63377da90f78b58a9c
Author: Ming Lei <ming.lei@redhat.com>
Date:   Tue Mar 6 12:07:13 2018 +0800

    block: null_blk: fix 'Invalid parameters' when loading module
    
    [ Upstream commit 66231ad3e2886ba99fbf440cea44cab547e5163f ]
    
    On ARM64, the default page size has been 64K on some distributions, and
    we should allow ARM64 people to play null_blk.
    
    This patch fixes the issue by extend page bitmap size for supporting
    other non-4KB PAGE_SIZE.
    
    Cc: Bart Van Assche <Bart.VanAssche@wdc.com>
    Cc: Shaohua Li <shli@kernel.org>
    Cc: Kyungchan Koh <kkc6196@fb.com>,
    Cc: weiping zhang <zhangweiping@didichuxing.com>
    Cc: Yi Zhang <yi.zhang@redhat.com>
    Reported-by: Yi Zhang <yi.zhang@redhat.com>
    Signed-off-by: Ming Lei <ming.lei@redhat.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e38a9a7c948166e3c21bbb40f54c500e6447698a
Author: Dexuan Cui <decui@microsoft.com>
Date:   Sun Mar 4 22:17:14 2018 -0700

    tools: hv: fix compiler warnings about major/target_fname
    
    [ Upstream commit 1330fc35327f3ecdfa1aa645e7321ced7349b2cd ]
    
    This patch fixes the below warnings with new glibc and gcc:
    
    hv_vss_daemon.c:100:13: warning: In the GNU C Library, "major" is defined
     by <sys/sysmacros.h>. For historical compatibility, it is currently
    defined by <sys/types.h> as well, but we plan to  remove this soon.
    To use "major", include <sys/sysmacros.h>  directly.
    
    hv_fcopy_daemon.c:42:2: note: 'snprintf' output between 2 and 1040
    bytes into a destination of size 260
    
    Signed-off-by: Dexuan Cui <decui@microsoft.com>
    Cc: Stephen Hemminger <sthemmin@microsoft.com>
    Cc: K. Y. Srinivasan <kys@microsoft.com>
    Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4ad141b198ca7e6c805f0d71e03f53aee7824069
Author: Emily Deng <Emily.Deng@amd.com>
Date:   Wed Mar 7 09:47:43 2018 +0800

    drm/amdgpu: Clean sdma wptr register when only enable wptr polling
    
    [ Upstream commit 4062119b9d958df33bcda703dc3ac646908fa861 ]
    
    The sdma wptr polling memory is not fast enough, then the sdma
    wptr register will be random, and not equal to sdma rptr, which
    will cause sdma engine hang when load driver, so clean up the sdma
    wptr directly to fix this issue.
    
    v2:add comment above the code and correct coding style
    
    Reviewed-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Emily Deng <Emily.Deng@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 524fc4c581e33ebd1b3c5b062c4a8489219622fb
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Mon Mar 5 11:17:02 2018 +0100

    drm/bridge: sii902x: Retry status read after DDI I2C
    
    [ Upstream commit 2e7a66a8b5ebf1b04a866e5d7c981640f7f62934 ]
    
    The following happens when connection a DVI output driven
    from the SiI9022 using a DVI-to-VGA adapter plug:
    
    i2c i2c-0: sendbytes: NAK bailout.
    i2c i2c-0: sendbytes: NAK bailout.
    
    Then no picture. Apparently the I2C engine inside the SiI9022
    is not smart enough to try to fall back to DDC I2C. Or the
    vendor have not integrated the electronics properly. I don't
    know which one it is.
    
    After this, the I2C bus seems stalled and the first attempt to
    read the status register fails, and the code returns with
    negative return value, and the display fails to initialized.
    
    Instead, retry status readout five times and continue even
    if this fails.
    
    Tested on the ARM Versatile Express with a DVI-to-VGA
    connector, it now gives picture.
    
    Introduce a helper struct device *dev variable to make
    the code more readable.
    
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Reviewed-by: Liviu Dudau <Liviu.Dudau@arm.com>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20180305101702.13441-1-linus.walleij@linaro.org
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e15d87912c534e7bbf1f53667ce263ccd8c18ef8
Author: Vivek Gautam <vivek.gautam@codeaurora.org>
Date:   Tue Jan 16 16:26:56 2018 +0530

    phy: qcom-qmp: Fix phy pipe clock gating
    
    [ Upstream commit f8ba22a39e985c93e278709b1d5f20857a26b49b ]
    
    Pipe clock comes out of the phy and is available as long as
    the phy is turned on. Clock controller fails to gate this
    clock after the phy is turned off and generates a warning.
    
    / # [   33.048561] gcc_usb3_phy_pipe_clk status stuck at 'on'
    [   33.048585] ------------[ cut here ]------------
    [   33.052621] WARNING: CPU: 1 PID: 18 at ../drivers/clk/qcom/clk-branch.c:97 clk_branch_wait+0xf0/0x108
    [   33.057384] Modules linked in:
    [   33.066497] CPU: 1 PID: 18 Comm: kworker/1:0 Tainted: G        W       4.12.0-rc7-00024-gfe926e34c36d-dirty #96
    [   33.069451] Hardware name: Qualcomm Technologies, Inc. DB820c (DT)
    ...
    [   33.278565] [<ffff00000849b27c>] clk_branch_wait+0xf0/0x108
    [   33.286375] [<ffff00000849b2f4>] clk_branch2_disable+0x28/0x34
    [   33.291761] [<ffff0000084868dc>] clk_core_disable+0x5c/0x88
    [   33.297660] [<ffff000008487d68>] clk_core_disable_lock+0x20/0x34
    [   33.303129] [<ffff000008487d98>] clk_disable+0x1c/0x24
    [   33.309384] [<ffff0000083ccd78>] qcom_qmp_phy_poweroff+0x20/0x48
    [   33.314328] [<ffff0000083c53f4>] phy_power_off+0x80/0xdc
    [   33.320492] [<ffff00000875c950>] dwc3_core_exit+0x94/0xa0
    [   33.325784] [<ffff00000875c9ac>] dwc3_suspend_common+0x50/0x60
    [   33.331080] [<ffff00000875ca04>] dwc3_runtime_suspend+0x48/0x6c
    [   33.336810] [<ffff0000085b82f4>] pm_generic_runtime_suspend+0x28/0x38
    [   33.342627] [<ffff0000085bace0>] __rpm_callback+0x150/0x254
    [   33.349222] [<ffff0000085bae08>] rpm_callback+0x24/0x78
    [   33.354604] [<ffff0000085b9fd8>] rpm_suspend+0xe0/0x4e4
    [   33.359813] [<ffff0000085bb784>] pm_runtime_work+0xdc/0xf0
    [   33.365028] [<ffff0000080d7b30>] process_one_work+0x12c/0x28c
    [   33.370576] [<ffff0000080d7ce8>] worker_thread+0x58/0x3b8
    [   33.376393] [<ffff0000080dd4a8>] kthread+0x100/0x12c
    [   33.381776] [<ffff0000080836c0>] ret_from_fork+0x10/0x50
    
    Fix this by disabling it as the first thing in phy_exit().
    
    Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")
    Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
    Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
    Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 370423926842a4a72af22da77efa24ee23b8d0f4
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Mar 8 08:26:48 2018 +0100

    ALSA: vmaster: Propagate slave error
    
    [ Upstream commit 2e2c177ca84aff092c3c96714b0f6a12900f3946 ]
    
    In slave_update() of vmaster code ignores the error from the slave
    get() callback and copies the values.  It's not only about the missing
    error code but also that this may potentially lead to a leak of
    uninitialized variables when the slave get() don't clear them.
    
    This patch fixes slave_update() not to copy the potentially
    uninitialized values when an error is returned from the slave get()
    callback, and to propagate the error value properly.
    
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 334cdf82014458591271b0ebea7d4cab5e6fea26
Author: Shawn Lin <shawn.lin@rock-chips.com>
Date:   Thu Jan 11 10:40:26 2018 +0800

    phy: rockchip-emmc: retry calpad busy trimming
    
    [ Upstream commit a4781c2a74b249cad814ceea7272997bbd20051e ]
    
    It turns out that 5us isn't enough for all cases, so let's
    retry some more times to wait for caldone.
    
    Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
    Tested-by: Ziyuan Xu <xzy.xu@rock-chips.com>
    Signed-off-by: Caesar Wang <wxt@rock-chips.com>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1c204f040f2da8b12a5e0e61dd60b09166d45630
Author: Ivan Gorinov <ivan.gorinov@intel.com>
Date:   Wed Mar 7 11:46:53 2018 -0800

    x86/devicetree: Fix device IRQ settings in DT
    
    [ Upstream commit 0a5169add90e43ab45ab1ba34223b8583fcaf675 ]
    
    IRQ parameters for the SoC devices connected directly to I/O APIC lines
    (without PCI IRQ routing) may be specified in the Device Tree.
    
    Called from DT IRQ parser, irq_create_fwspec_mapping() calls
    irq_domain_alloc_irqs() with a pointer to irq_fwspec structure as @arg.
    
    But x86-specific DT IRQ allocation code casts @arg to of_phandle_args
    structure pointer and crashes trying to read the IRQ parameters. The
    function was not converted when the mapping descriptor was changed to
    irq_fwspec in the generic irqdomain code.
    
    Fixes: 11e4438ee330 ("irqdomain: Introduce a firmware-specific IRQ specifier structure")
    Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Rob Herring <robh+dt@kernel.org>
    Link: https://lkml.kernel.org/r/a234dee27ea60ce76141872da0d6bdb378b2a9ee.1520450752.git.ivan.gorinov@intel.com
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0e73d86339fcf6cb6ba93d9812490719187c7770
Author: Ivan Gorinov <ivan.gorinov@intel.com>
Date:   Wed Mar 7 11:46:29 2018 -0800

    x86/devicetree: Initialize device tree before using it
    
    [ Upstream commit 628df9dc5ad886b0a9b33c75a7b09710eb859ca1 ]
    
    Commit 08d53aa58cb1 added CRC32 calculation in early_init_dt_verify() and
    checking in late initcall of_fdt_raw_init(), making early_init_dt_verify()
    mandatory.
    
    The required call to early_init_dt_verify() was not added to the
    x86-specific implementation, causing failure to create the sysfs entry in
    of_fdt_raw_init().
    
    Fixes: 08d53aa58cb1 ("of/fdt: export fdt blob as /sys/firmware/fdt")
    Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Rob Herring <robh+dt@kernel.org>
    Link: https://lkml.kernel.org/r/c8c7e941efc63b5d25ebf9b6350b0f3df38f6098.1520450752.git.ivan.gorinov@intel.com
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0bb789d2aa7d44dccbe9e7835c598caf2dfa5271
Author: Andreas Gruenbacher <agruenba@redhat.com>
Date:   Tue Feb 20 08:03:24 2018 -0700

    gfs2: Fix fallocate chunk size
    
    [ Upstream commit 174d1232ebc84fcde8f5889d1171c9c7e74a10a7 ]
    
    The chunk size of allocations in __gfs2_fallocate is calculated
    incorrectly.  The size can collapse, causing __gfs2_fallocate to
    allocate one block at a time, which is very inefficient.  This needs
    fixing in two places:
    
    In gfs2_quota_lock_check, always set ap->allowed to UINT_MAX to indicate
    that there is no quota limit.  This fixes callers that rely on
    ap->allowed to be set even when quotas are off.
    
    In __gfs2_fallocate, reset max_blks to UINT_MAX in each iteration of the
    loop to make sure that allocation limits from one resource group won't
    spill over into another resource group.
    
    Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
    Signed-off-by: Bob Peterson <rpeterso@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 80860b187e748530cdf4cfc4a7406f34f468d2df
Author: Bjorn Andersson <bjorn.andersson@linaro.org>
Date:   Tue Feb 27 16:45:25 2018 -0800

    soc: qcom: wcnss_ctrl: Fix increment in NV upload
    
    [ Upstream commit 90c29ed7627b6b4aeb603ee197650173c8434512 ]
    
    hdr.len includes both the size of the header and the fragment, so using
    this when stepping through the firmware causes us to skip 16 bytes every
    chunk of 3072 bytes; causing only the first fragment to actually be
    valid data.
    
    Instead use fragment size steps through the firmware blob.
    
    Fixes: ea7a1f275cf0 ("soc: qcom: Introduce WCNSS_CTRL SMD client")
    Reported-by: Will Newton <will.newton@gmail.com>
    Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
    Signed-off-by: Andy Gross <andy.gross@linaro.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 796a7326258de27c12a87dde58945a515c80c8c2
Author: Ilia Lin <ilialin@codeaurora.org>
Date:   Tue Jan 23 09:36:18 2018 +0200

    arm64: dts: qcom: Fix SPI5 config on MSM8996
    
    [ Upstream commit e723795c702b52cfceb3bb3faa63059eb4658313 ]
    
    Set correct clocks and interrupt values.
    Fixes the incorrect SPI master configuration. This is
    mandatory to make the SPI5 interface functional.
    
    Signed-off-by: Ilia Lin <ilialin@codeaurora.org>
    Signed-off-by: Andy Gross <andy.gross@linaro.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5aedcd7097e3f99ce37b734ec97ef06ab85fc122
Author: Kan Liang <kan.liang@linux.intel.com>
Date:   Mon Feb 12 14:20:31 2018 -0800

    perf/x86/intel: Fix event update for auto-reload
    
    [ Upstream commit d31fc13fdcb20e1c317f9a7dd6273c18fbd58308 ]
    
    There is a bug when reading event->count with large PEBS enabled.
    
    Here is an example:
    
      # ./read_count
      0x71f0
      0x122c0
      0x1000000001c54
      0x100000001257d
      0x200000000bdc5
    
    In fixed period mode, the auto-reload mechanism could be enabled for
    PEBS events, but the calculation of event->count does not take the
    auto-reload values into account.
    
    Anyone who reads event->count will get the wrong result, e.g x86_pmu_read().
    
    This bug was introduced with the auto-reload mechanism enabled since
    commit:
    
      851559e35fd5 ("perf/x86/intel: Use the PEBS auto reload mechanism when possible")
    
    Introduce intel_pmu_save_and_restart_reload() to calculate the
    event->count only for auto-reload.
    
    Since the counter increments a negative counter value and overflows on
    the sign switch, giving the interval:
    
            [-period, 0]
    
    the difference between two consequtive reads is:
    
     A) value2 - value1;
        when no overflows have happened in between,
     B) (0 - value1) + (value2 - (-period));
        when one overflow happened in between,
     C) (0 - value1) + (n - 1) * (period) + (value2 - (-period));
        when @n overflows happened in between.
    
    Here A) is the obvious difference, B) is the extension to the discrete
    interval, where the first term is to the top of the interval and the
    second term is from the bottom of the next interval and C) the extension
    to multiple intervals, where the middle term is the whole intervals
    covered.
    
    The equation for all cases is:
    
        value2 - value1 + n * period
    
    Previously the event->count is updated right before the sample output.
    But for case A, there is no PEBS record ready. It needs to be specially
    handled.
    
    Remove the auto-reload code from x86_perf_event_set_period() since
    we'll not longer call that function in this case.
    
    Based-on-code-from: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vince Weaver <vincent.weaver@maine.edu>
    Cc: acme@kernel.org
    Fixes: 851559e35fd5 ("perf/x86/intel: Use the PEBS auto reload mechanism when possible")
    Link: http://lkml.kernel.org/r/1518474035-21006-2-git-send-email-kan.liang@linux.intel.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 40f613ea9097652ed1b49e78dd3e79f10c74a7e9
Author: Kan Liang <kan.liang@linux.intel.com>
Date:   Thu Mar 1 12:54:54 2018 -0500

    perf/x86/intel: Fix large period handling on Broadwell CPUs
    
    [ Upstream commit f605cfca8c39ffa2b98c06d2b9f30ba64f1e54e3 ]
    
    Large fixed period values could be truncated on Broadwell, for example:
    
      perf record -e cycles -c 10000000000
    
    Here the fixed period is 0x2540BE400, but the period which finally applied is
    0x540BE400 - which is wrong.
    
    The reason is that x86_pmu::limit_period() uses an u32 parameter, so the
    high 32 bits of 'period' get truncated.
    
    This bug was introduced in:
    
      commit 294fe0f52a44 ("perf/x86/intel: Add INST_RETIRED.ALL workarounds")
    
    It's safe to use u64 instead of u32:
    
     - Although the 'left' is s64, the value of 'left' must be positive when
       calling limit_period().
    
     - bdw_limit_period() only modifies the lowest 6 bits, it doesn't touch
       the higher 32 bits.
    
    Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vince Weaver <vincent.weaver@maine.edu>
    Fixes: 294fe0f52a44 ("perf/x86/intel: Add INST_RETIRED.ALL workarounds")
    Link: http://lkml.kernel.org/r/1519926894-3520-1-git-send-email-kan.liang@linux.intel.com
    [ Rewrote unacceptably bad changelog. ]
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit df585312af85476dc59c1240a934a942d0c6ec8b
Author: Mark Rutland <mark.rutland@arm.com>
Date:   Thu Mar 8 08:00:09 2018 +0000

    efi/arm*: Only register page tables when they exist
    
    [ Upstream commit 6b31a2fa1e8f7bc6c2a474b4a12dad7a145cf83d ]
    
    Currently the arm/arm64 runtime code registers the runtime servies
    pagetables with ptdump regardless of whether runtime services page
    tables have been created.
    
    As efi_mm.pgd is NULL in these cases, attempting to dump the efi page
    tables results in a NULL pointer dereference in the ptdump code:
    
    /sys/kernel/debug# cat efi_page_tables
    [  479.522600] Unable to handle kernel NULL pointer dereference at virtual address 00000000
    [  479.522715] Mem abort info:
    [  479.522764]   ESR = 0x96000006
    [  479.522850]   Exception class = DABT (current EL), IL = 32 bits
    [  479.522899]   SET = 0, FnV = 0
    [  479.522937]   EA = 0, S1PTW = 0
    [  479.528200] Data abort info:
    [  479.528230]   ISV = 0, ISS = 0x00000006
    [  479.528317]   CM = 0, WnR = 0
    [  479.528317] user pgtable: 4k pages, 48-bit VAs, pgd = 0000000064ab0cb0
    [  479.528449] [0000000000000000] *pgd=00000000fbbe4003, *pud=00000000fb66e003, *pmd=0000000000000000
    [  479.528600] Internal error: Oops: 96000006 [#1] PREEMPT SMP
    [  479.528664] Modules linked in:
    [  479.528699] CPU: 0 PID: 2457 Comm: cat Not tainted 4.15.0-rc3-00065-g2ad2ee7ecb5c-dirty #7
    [  479.528799] Hardware name: FVP Base (DT)
    [  479.528899] pstate: 00400009 (nzcv daif +PAN -UAO)
    [  479.528941] pc : walk_pgd.isra.1+0x20/0x1d0
    [  479.529011] lr : ptdump_walk_pgd+0x30/0x50
    [  479.529105] sp : ffff00000bf4bc20
    [  479.529185] x29: ffff00000bf4bc20 x28: 0000ffff9d22e000
    [  479.529271] x27: 0000000000020000 x26: ffff80007b4c63c0
    [  479.529358] x25: 00000000014000c0 x24: ffff80007c098900
    [  479.529445] x23: ffff00000bf4beb8 x22: 0000000000000000
    [  479.529532] x21: ffff00000bf4bd70 x20: 0000000000000001
    [  479.529618] x19: ffff00000bf4bcb0 x18: 0000000000000000
    [  479.529760] x17: 000000000041a1c8 x16: ffff0000082139d8
    [  479.529800] x15: 0000ffff9d3c6030 x14: 0000ffff9d2527f4
    [  479.529924] x13: 00000000000003f3 x12: 0000000000000038
    [  479.530000] x11: 0000000000000003 x10: 0101010101010101
    [  479.530099] x9 : 0000000017e94050 x8 : 000000000000003f
    [  479.530226] x7 : 0000000000000000 x6 : 0000000000000000
    [  479.530313] x5 : 0000000000000001 x4 : 0000000000000000
    [  479.530416] x3 : ffff000009069fd8 x2 : 0000000000000000
    [  479.530500] x1 : 0000000000000000 x0 : 0000000000000000
    [  479.530599] Process cat (pid: 2457, stack limit = 0x000000005d1b0e6f)
    [  479.530660] Call trace:
    [  479.530746]  walk_pgd.isra.1+0x20/0x1d0
    [  479.530833]  ptdump_walk_pgd+0x30/0x50
    [  479.530907]  ptdump_show+0x10/0x20
    [  479.530920]  seq_read+0xc8/0x470
    [  479.531023]  full_proxy_read+0x60/0x90
    [  479.531100]  __vfs_read+0x18/0x100
    [  479.531180]  vfs_read+0x88/0x160
    [  479.531267]  SyS_read+0x48/0xb0
    [  479.531299]  el0_svc_naked+0x20/0x24
    [  479.531400] Code: 91400420 f90033a0 a90707a2 f9403fa0 (f9400000)
    [  479.531499] ---[ end trace bfe8e28d8acb2b67 ]---
    Segmentation fault
    
    Let's avoid this problem by only registering the tables after their
    successful creation, which is also less confusing when EFI runtime
    services are not in use.
    
    Reported-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Mark Rutland <mark.rutland@arm.com>
    Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Acked-by: Will Deacon <will.deacon@arm.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Matt Fleming <matt@codeblueprint.co.uk>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: linux-efi@vger.kernel.org
    Link: http://lkml.kernel.org/r/20180308080020.22828-2-ard.biesheuvel@linaro.org
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 12d9bc69beb03c0e6fe729811b89c023bdb9c8a1
Author: Maurizio Lombardi <mlombard@redhat.com>
Date:   Fri Mar 9 13:59:06 2018 +0100

    cdrom: do not call check_disk_change() inside cdrom_open()
    
    [ Upstream commit 2bbea6e117357d17842114c65e9a9cf2d13ae8a3 ]
    
    when mounting an ISO filesystem sometimes (very rarely)
    the system hangs because of a race condition between two tasks.
    
    PID: 6766   TASK: ffff88007b2a6dd0  CPU: 0   COMMAND: "mount"
     #0 [ffff880078447ae0] __schedule at ffffffff8168d605
     #1 [ffff880078447b48] schedule_preempt_disabled at ffffffff8168ed49
     #2 [ffff880078447b58] __mutex_lock_slowpath at ffffffff8168c995
     #3 [ffff880078447bb8] mutex_lock at ffffffff8168bdef
     #4 [ffff880078447bd0] sr_block_ioctl at ffffffffa00b6818 [sr_mod]
     #5 [ffff880078447c10] blkdev_ioctl at ffffffff812fea50
     #6 [ffff880078447c70] ioctl_by_bdev at ffffffff8123a8b3
     #7 [ffff880078447c90] isofs_fill_super at ffffffffa04fb1e1 [isofs]
     #8 [ffff880078447da8] mount_bdev at ffffffff81202570
     #9 [ffff880078447e18] isofs_mount at ffffffffa04f9828 [isofs]
    #10 [ffff880078447e28] mount_fs at ffffffff81202d09
    #11 [ffff880078447e70] vfs_kern_mount at ffffffff8121ea8f
    #12 [ffff880078447ea8] do_mount at ffffffff81220fee
    #13 [ffff880078447f28] sys_mount at ffffffff812218d6
    #14 [ffff880078447f80] system_call_fastpath at ffffffff81698c49
        RIP: 00007fd9ea914e9a  RSP: 00007ffd5d9bf648  RFLAGS: 00010246
        RAX: 00000000000000a5  RBX: ffffffff81698c49  RCX: 0000000000000010
        RDX: 00007fd9ec2bc210  RSI: 00007fd9ec2bc290  RDI: 00007fd9ec2bcf30
        RBP: 0000000000000000   R8: 0000000000000000   R9: 0000000000000010
        R10: 00000000c0ed0001  R11: 0000000000000206  R12: 00007fd9ec2bc040
        R13: 00007fd9eb6b2380  R14: 00007fd9ec2bc210  R15: 00007fd9ec2bcf30
        ORIG_RAX: 00000000000000a5  CS: 0033  SS: 002b
    
    This task was trying to mount the cdrom.  It allocated and configured a
    super_block struct and owned the write-lock for the super_block->s_umount
    rwsem. While exclusively owning the s_umount lock, it called
    sr_block_ioctl and waited to acquire the global sr_mutex lock.
    
    PID: 6785   TASK: ffff880078720fb0  CPU: 0   COMMAND: "systemd-udevd"
     #0 [ffff880078417898] __schedule at ffffffff8168d605
     #1 [ffff880078417900] schedule at ffffffff8168dc59
     #2 [ffff880078417910] rwsem_down_read_failed at ffffffff8168f605
     #3 [ffff880078417980] call_rwsem_down_read_failed at ffffffff81328838
     #4 [ffff8800784179d0] down_read at ffffffff8168cde0
     #5 [ffff8800784179e8] get_super at ffffffff81201cc7
     #6 [ffff880078417a10] __invalidate_device at ffffffff8123a8de
     #7 [ffff880078417a40] flush_disk at ffffffff8123a94b
     #8 [ffff880078417a88] check_disk_change at ffffffff8123ab50
     #9 [ffff880078417ab0] cdrom_open at ffffffffa00a29e1 [cdrom]
    #10 [ffff880078417b68] sr_block_open at ffffffffa00b6f9b [sr_mod]
    #11 [ffff880078417b98] __blkdev_get at ffffffff8123ba86
    #12 [ffff880078417bf0] blkdev_get at ffffffff8123bd65
    #13 [ffff880078417c78] blkdev_open at ffffffff8123bf9b
    #14 [ffff880078417c90] do_dentry_open at ffffffff811fc7f7
    #15 [ffff880078417cd8] vfs_open at ffffffff811fc9cf
    #16 [ffff880078417d00] do_last at ffffffff8120d53d
    #17 [ffff880078417db0] path_openat at ffffffff8120e6b2
    #18 [ffff880078417e48] do_filp_open at ffffffff8121082b
    #19 [ffff880078417f18] do_sys_open at ffffffff811fdd33
    #20 [ffff880078417f70] sys_open at ffffffff811fde4e
    #21 [ffff880078417f80] system_call_fastpath at ffffffff81698c49
        RIP: 00007f29438b0c20  RSP: 00007ffc76624b78  RFLAGS: 00010246
        RAX: 0000000000000002  RBX: ffffffff81698c49  RCX: 0000000000000000
        RDX: 00007f2944a5fa70  RSI: 00000000000a0800  RDI: 00007f2944a5fa70
        RBP: 00007f2944a5f540   R8: 0000000000000000   R9: 0000000000000020
        R10: 00007f2943614c40  R11: 0000000000000246  R12: ffffffff811fde4e
        R13: ffff880078417f78  R14: 000000000000000c  R15: 00007f2944a4b010
        ORIG_RAX: 0000000000000002  CS: 0033  SS: 002b
    
    This task tried to open the cdrom device, the sr_block_open function
    acquired the global sr_mutex lock. The call to check_disk_change()
    then saw an event flag indicating a possible media change and tried
    to flush any cached data for the device.
    As part of the flush, it tried to acquire the super_block->s_umount
    lock associated with the cdrom device.
    This was the same super_block as created and locked by the previous task.
    
    The first task acquires the s_umount lock and then the sr_mutex_lock;
    the second task acquires the sr_mutex_lock and then the s_umount lock.
    
    This patch fixes the issue by moving check_disk_change() out of
    cdrom_open() and let the caller take care of it.
    
    Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 11a145951cb00d7c7beaf02195686b44a7f43d55
Author: Kan Liang <kan.liang@linux.intel.com>
Date:   Tue Feb 20 02:11:50 2018 -0800

    perf/x86/intel: Properly save/restore the PMU state in the NMI handler
    
    [ Upstream commit 82d71ed0277efc45360828af8c4e4d40e1b45352 ]
    
    The PMU is disabled in intel_pmu_handle_irq(), but cpuc->enabled is not updated
    accordingly.
    
    This is fine in current usage because no-one checks it - but fix it
    for future code: for example, the drain_pebs() will be modified to
    fix an auto-reload bug.
    
    Properly save/restore the old PMU state.
    
    Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vince Weaver <vincent.weaver@maine.edu>
    Cc: acme@kernel.org
    Cc: kernel test robot <fengguang.wu@intel.com>
    Link: http://lkml.kernel.org/r/6f44ee84-56f8-79f1-559b-08e371eaeb78@linux.intel.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1a596a9a813cecb6d4ecb0f693d1417f48746b72
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Sat Mar 10 17:55:47 2018 -0800

    hwmon: (pmbus/adm1275) Accept negative page register values
    
    [ Upstream commit ecb29abd4cb0670c616fb563a078f25d777ce530 ]
    
    A negative page register value means that no page needs to be
    selected. This is used by status register read operations and needs
    to be accepted. The failure to do so so results in missed status
    and limit registers.
    
    Fixes: da8e48ab483e1 ("hwmon: (pmbus) Always call _pmbus_read_byte in core driver")
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 754e568c569314a3a286074802d0d6c6f864b236
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Sat Mar 10 17:49:47 2018 -0800

    hwmon: (pmbus/max8688) Accept negative page register values
    
    [ Upstream commit a46f8cd696624ef757be0311eb28f119c36778e8 ]
    
    A negative page register value means that no page needs to be
    selected. This is used by status register evaluations and needs
    to be accepted.
    
    Fixes: da8e48ab483e1 ("hwmon: (pmbus) Always call _pmbus_read_byte in core driver")
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a0fc29c0476b9184abc5ff43c36eb0d280e0428c
Author: Eric Anholt <eric@anholt.net>
Date:   Fri Mar 9 15:33:32 2018 -0800

    drm/panel: simple: Fix the bus format for the Ontat panel
    
    [ Upstream commit 5651e5e094591f479adad5830ac1bc45196a39b3 ]
    
    This fixes bad color output.  When I was first testing the device I
    had the DPI hardware set to 666 mode, but apparently in the refactor
    to use the bus_format information from the panel driver, I failed to
    actually update the panel.
    
    Signed-off-by: Eric Anholt <eric@anholt.net>
    Fixes: e8b6f561b2ee ("drm/panel: simple: Add the 7" DPI panel from Adafruit")
    Cc: Thierry Reding <thierry.reding@gmail.com>
    Signed-off-by: Thierry Reding <treding@nvidia.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20180309233332.1769-1-eric@anholt.net
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4e548646075d61912381ea67f2b4a3e51db311d2
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Fri Mar 9 12:52:04 2018 +0100

    perf/core: Fix perf_output_read_group()
    
    [ Upstream commit 9e5b127d6f33468143d90c8a45ca12410e4c3fa7 ]
    
    Mark reported his arm64 perf fuzzer runs sometimes splat like:
    
      armv8pmu_read_counter+0x1e8/0x2d8
      armpmu_event_update+0x8c/0x188
      armpmu_read+0xc/0x18
      perf_output_read+0x550/0x11e8
      perf_event_read_event+0x1d0/0x248
      perf_event_exit_task+0x468/0xbb8
      do_exit+0x690/0x1310
      do_group_exit+0xd0/0x2b0
      get_signal+0x2e8/0x17a8
      do_signal+0x144/0x4f8
      do_notify_resume+0x148/0x1e8
      work_pending+0x8/0x14
    
    which asserts that we only call pmu::read() on ACTIVE events.
    
    The above callchain does:
    
      perf_event_exit_task()
        perf_event_exit_task_context()
          task_ctx_sched_out() // INACTIVE
          perf_event_exit_event()
            perf_event_set_state(EXIT) // EXIT
            sync_child_event()
              perf_event_read_event()
                perf_output_read()
                  perf_output_read_group()
                    leader->pmu->read()
    
    Which results in doing a pmu::read() on an !ACTIVE event.
    
    I _think_ this is 'new' since we added attr.inherit_stat, which added
    the perf_event_read_event() to the exit path, without that
    perf_event_read_output() would only trigger from samples and for
    @event to trigger a sample, it's leader _must_ be ACTIVE too.
    
    Still, adding this check makes it consistent with the @sub case for
    the siblings.
    
    Reported-and-Tested-by: Mark Rutland <mark.rutland@arm.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vince Weaver <vincent.weaver@maine.edu>
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8d9332277a451d14d5dbe1c628e3460ef0766a3f
Author: Pierre Bourdon <delroth@google.com>
Date:   Tue Feb 20 16:03:18 2018 +0100

    max17042: propagate of_node to power supply device
    
    [ Upstream commit 66ec32fc7cd116dab5c02603ea8ec28ff92da3b5 ]
    
    max17042_get_status uses the core power_supply_am_i_supplied. That
    function relies on DT properties to figure out the power supply
    topology, and will error out without DT.
    
    Fixes max17042 battery status being reported as "unknown".
    
    Signed-off-by: Pierre Bourdon <delroth@google.com>
    Signed-off-by: Andre Heider <a.heider@gmail.com>
    Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 62d90905e54b082787d2364503c19d1836b36aa6
Author: leilei.lin <leilei.lin@alibaba-inc.com>
Date:   Tue Mar 6 17:36:37 2018 +0800

    perf/core: Fix installing cgroup events on CPU
    
    [ Upstream commit 33801b94741d6c3be9713c10aa627477216c21e2 ]
    
    There's two problems when installing cgroup events on CPUs: firstly
    list_update_cgroup_event() only tries to set cpuctx->cgrp for the
    first event, if that mismatches on @cgrp we'll not try again for later
    additions.
    
    Secondly, when we install a cgroup event into an active context, only
    issue an event reprogram when the event matches the current cgroup
    context. This avoids a pointless event reprogramming.
    
    Signed-off-by: leilei.lin <leilei.lin@alibaba-inc.com>
    [ Improved the changelog and comments. ]
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vince Weaver <vincent.weaver@maine.edu>
    Cc: brendan.d.gregg@gmail.com
    Cc: eranian@gmail.com
    Cc: linux-kernel@vger.kernel.org
    Cc: yang_oliver@hotmail.com
    Link: http://lkml.kernel.org/r/20180306093637.28247-1-linxiulei@gmail.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 808e6f9dd955057615eed887f5cd1d6a9bff2eb2
Author: Chao Yu <yuchao0@huawei.com>
Date:   Sat Jan 27 17:29:49 2018 +0800

    f2fs: fix to check extent cache in f2fs_drop_extent_tree
    
    [ Upstream commit bf617f7a92edc6bb2909db2bfa4576f50b280ee5 ]
    
    If noextent_cache mount option is on, we will never initialize extent tree
    in inode, but still we're going to access it in f2fs_drop_extent_tree,
    result in kernel panic as below:
    
     BUG: unable to handle kernel NULL pointer dereference at 0000000000000038
     IP: _raw_write_lock+0xc/0x30
     Call Trace:
      ? f2fs_drop_extent_tree+0x41/0x70 [f2fs]
      f2fs_fallocate+0x5a0/0xdd0 [f2fs]
      ? common_file_perm+0x47/0xc0
      ? apparmor_file_permission+0x1a/0x20
      vfs_fallocate+0x15b/0x290
      SyS_fallocate+0x44/0x70
      do_syscall_64+0x6e/0x160
      entry_SYSCALL64_slow_path+0x25/0x25
    
    This patch fixes to check extent cache status before using in
    f2fs_drop_extent_tree.
    
    Signed-off-by: Chao Yu <yuchao0@huawei.com>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d832729081ad6ca3420a0ed272cb323ced86781f
Author: Chao Yu <yuchao0@huawei.com>
Date:   Wed Jan 31 09:30:34 2018 +0800

    f2fs: fix to clear CP_TRIMMED_FLAG
    
    [ Upstream commit cd36d7a17f9da68be9aa67185ba3ad7969934a19 ]
    
    Once CP_TRIMMED_FLAG is set, after a reboot, we will never issue discard
    before LBA becomes invalid again, fix it by clearing the flag in
    checkpoint without CP_TRIMMED reason.
    
    Fixes: 1f43e2ad7bff ("f2fs: introduce CP_TRIMMED_FLAG to avoid unneeded discard")
    Signed-off-by: Chao Yu <yuchao0@huawei.com>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2f9cc50f2e6adebf35a980670810beb9ff908771
Author: Chao Yu <yuchao0@huawei.com>
Date:   Sun Feb 25 23:38:21 2018 +0800

    f2fs: fix to set KEEP_SIZE bit in f2fs_zero_range
    
    [ Upstream commit 17cd07ae95073c298af92c1ba14ac58ce84de33b ]
    
    As Jayashree Mohan reported:
    
    A simple workload to reproduce this would be :
    1. create foo
    2. Write (8K - 16K)  // foo size = 16K now
    3. fsync()
    4. falloc zero_range , keep_size (4202496 - 4210688) // foo size must be 16K
    5. fdatasync()
    Crash now
    
    On recovery, we see that the file size is 4210688 and not 16K, which
    violates the semantics of keep_size flag. We have a test case to
    reproduce this using CrashMonkey on 4.15 kernel. Try this out by
    simply running :
     ./c_harness -f /dev/sda -d /dev/cow_ram0 -t f2fs -e 102400  -P -v
     tests/generic_468_zero.so
    
    The root cause is that we miss to set KEEP_SIZE bit correctly in zero_range
    when zeroing block cross EOF with FALLOC_FL_KEEP_SIZE, let's fix this
    missing case.
    
    Signed-off-by: Chao Yu <yuchao0@huawei.com>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1220a1fbb0d9e2e240d239d17ce2504850e7e484
Author: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
Date:   Thu Feb 15 21:19:24 2018 +0530

    cxl: Check if PSL data-cache is available before issue flush request
    
    [ Upstream commit 94322ed8e857e3b2a33cf75118051af9baaa110f ]
    
    PSL9D doesn't have a data-cache that needs to be flushed before
    resetting the card. However when cxl tries to flush data-cache on such
    a card, it times-out as PSL_Control register never indicates flush
    operation complete due to missing data-cache. This is usually
    indicated in the kernel logs with this message:
    
    "WARNING: cache flush timed out"
    
    To fix this the patch checks PSL_Debug register CDC-Field(BIT:27)
    which indicates the absence of a data-cache and sets a flag
    'no_data_cache' in 'struct cxl_native' to indicate this. When
    cxl_data_cache_flush() is called it checks the flag and if set bails
    out early without requesting a data-cache flush operation to the PSL.
    
    Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
    Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
    Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 72e3d6a39f37a6b5808f9a4ea9a5e4c03c0c2c8e
Author: Gao Xiang <hsiangkao@aol.com>
Date:   Sat Feb 10 12:12:51 2018 +0800

    f2fs: flush cp pack except cp pack 2 page at first
    
    [ Upstream commit 46706d5917f4457a6befe7a39a15c89dbb1ce9ca ]
    
    Previously, we attempt to flush the whole cp pack in a single bio,
    however, when suddenly powering off at this time, we could get into
    an extreme scenario that cp pack 1 page and cp pack 2 page are updated
    and latest, but payload or current summaries are still partially
    outdated. (see reliable write in the UFS specification)
    
    This patch submits the whole cp pack except cp pack 2 page at first,
    and then writes the cp pack 2 page with an extra independent
    bio with pre-io barrier.
    
    Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
    Reviewed-by: Chao Yu <yuchao0@huawei.com>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 033bfe092940b146e7af4546494038a854d7e0ed
Author: Alistair Popple <alistair@popple.id.au>
Date:   Fri Mar 2 16:18:45 2018 +1100

    powerpc/powernv/npu: Fix deadlock in mmio_invalidate()
    
    [ Upstream commit 2b74e2a9b39df40a2b489af2d24079617c61ee0e ]
    
    When sending TLB invalidates to the NPU we need to send extra flushes due
    to a hardware issue. The original implementation would lock the all the
    ATSD MMIO registers sequentially before unlocking and relocking each of
    them sequentially to do the extra flush.
    
    This introduced a deadlock as it is possible for one thread to hold one
    ATSD register whilst waiting for another register to be freed while the
    other thread is holding that register waiting for the one in the first
    thread to be freed.
    
    For example if there are two threads and two ATSD registers:
    
      Thread A      Thread B
      ----------------------
      Acquire 1
      Acquire 2
      Release 1     Acquire 1
      Wait 1        Wait 2
    
    Both threads will be stuck waiting to acquire a register resulting in an
    RCU stall warning or soft lockup.
    
    This patch solves the deadlock by refactoring the code to ensure registers
    are not released between flushes and to ensure all registers are either
    acquired or released together and in order.
    
    Fixes: bbd5ff50afff ("powerpc/powernv/npu-dma: Add explicit flush when sending an ATSD")
    Signed-off-by: Alistair Popple <alistair@popple.id.au>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e11ac25bc6c76fb4b2d96fa5f600ca5b4bb5fd48
Author: Mathieu Malaterre <malat@debian.org>
Date:   Sun Feb 25 18:22:29 2018 +0100

    powerpc: Add missing prototype for arch_irq_work_raise()
    
    [ Upstream commit f5246862f82f1e16bbf84cda4cddf287672b30fe ]
    
    In commit 4f8b50bbbe63 ("irq_work, ppc: Fix up arch hooks") a new
    function arch_irq_work_raise() was added without a prototype in header
    irq_work.h.
    
    Fix the following warning (treated as error in W=1):
      arch/powerpc/kernel/time.c:523:6: error: no previous prototype for ‘arch_irq_work_raise’
    
    Signed-off-by: Mathieu Malaterre <malat@debian.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 107ccabdeaaf70137821f0f75792f93e1c6acef4
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Mon Mar 12 21:15:08 2018 +0100

    drm/meson: Fix an un-handled error path in 'meson_drv_bind_master()'
    
    [ Upstream commit e770f6bf18182bc3af6ceec30189b6c323cbc157 ]
    
    'drm_vblank_init()' can fail. So handle this (unlikely) error.
    
    Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Acked-by: Neil Armstrong <narmstrong@baylibre.com>
    Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/6cbf3d70ac3904489c7194c895225c4103aebb96.1520885192.git.christophe.jaillet@wanadoo.fr
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 13e9e65c061cc332bc34216c695c7999ffdd4c00
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Mon Mar 12 21:15:10 2018 +0100

    drm/meson: Fix some error handling paths in 'meson_drv_bind_master()'
    
    [ Upstream commit 2c18107b9d58972588cd45d89b8f58d0f033c110 ]
    
    If one of these functions fail, we whould free 'drm', as alreadry done in
    the other error handling paths, below and above.
    
    Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Acked-by: Neil Armstrong <narmstrong@baylibre.com>
    Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/df47e03d36c2cf7bc37ec3105fc47c16555bd946.1520885192.git.christophe.jaillet@wanadoo.fr
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8d3e64679b3961fced157d5e880cd9fae3368f6c
Author: Kamlakant Patel <kamlakant.patel@cavium.com>
Date:   Tue Mar 13 16:32:27 2018 +0530

    ipmi_ssif: Fix kernel panic at msg_done_handler
    
    [ Upstream commit f002612b9d86613bc6fde0a444e0095225f6053e ]
    
    This happens when BMC doesn't return any data and the code is trying
    to print the value of data[2].
    
    Getting following crash:
    [  484.728410] Unable to handle kernel NULL pointer dereference at virtual address 00000002
    [  484.736496] pgd = ffff0000094a2000
    [  484.739885] [00000002] *pgd=00000047fcffe003, *pud=00000047fcffd003, *pmd=0000000000000000
    [  484.748158] Internal error: Oops: 96000005 [#1] SMP
    [...]
    [  485.101451] Call trace:
    [...]
    [  485.188473] [<ffff000000a46e68>] msg_done_handler+0x668/0x700 [ipmi_ssif]
    [  485.195249] [<ffff000000a456b8>] ipmi_ssif_thread+0x110/0x128 [ipmi_ssif]
    [  485.202038] [<ffff0000080f1430>] kthread+0x108/0x138
    [  485.206994] [<ffff0000080838e0>] ret_from_fork+0x10/0x30
    [  485.212294] Code: aa1903e1 aa1803e0 b900227f 95fef6a5 (39400aa3)
    
    Adding a check to validate the data len before printing data[2] to fix this issue.
    
    Signed-off-by: Kamlakant Patel <kamlakant.patel@cavium.com>
    Signed-off-by: Corey Minyard <cminyard@mvista.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1bbbb41e47b7c3f33016d2143ac2f6be8dce041e
Author: Milton Miller <miltonm@us.ibm.com>
Date:   Fri Mar 9 15:58:19 2018 -0600

    watchdog: aspeed: Fix translation of reset mode to ctrl register
    
    [ Upstream commit d2fc8db691bf3197d43b2afb553311a9bf257bff ]
    
    Assert RESET_SYSTEM bit for any reset and set MODE field from reset
    type.
    
    The watchdog control register has a RESET_SYSTEM bit that is really
    closer to activate a reset, and RESET_SYSTEM_MODE field that chooses
    how much to reset.
    
    Before this patch, a node without these optional property would do a
    SOC reset, but a node with properties requesting a cpu or SOC reset
    would do nothing and a node requesting a system reset would do a
    SOC reset.
    
    Fixes: b7f0b8ad25f3 ("drivers/watchdog: ASPEED reference dev tree properties for config")
    Signed-off-by: Milton Miller <miltonm@us.ibm.com>
    Signed-off-by: Eddie James <eajames@linux.vnet.ibm.com>
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e49671435a2d39cfbf69dd083a1e94cc4beafce1
Author: Brian Norris <briannorris@chromium.org>
Date:   Fri Mar 9 19:46:06 2018 -0800

    watchdog: dw: RMW the control register
    
    [ Upstream commit a81abbb412341e9e3b2d42ed7d310cf71fbb84a8 ]
    
    RK3399 has rst_pulse_length in CONTROL_REG[4:2], determining the length
    of pulse to issue for system reset. We shouldn't clobber this value,
    because that might make the system reset ineffective. On RK3399, we're
    seeing that a value of 000b (meaning 2 cycles) yields an unreliable
    (partial?) reset, and so we only fully reset after the watchdog fires a
    second time. If we retain the system default (010b, or 8 clock cycles),
    then the watchdog reset is much more reliable.
    
    Read-modify-write retains the system value and improves reset
    reliability.
    
    It seems we were intentionally clobbering the response mode previously,
    to ensure we performed a system reset (we don't support an interrupt
    notification), so retain that explicitly.
    
    Signed-off-by: Brian Norris <briannorris@chromium.org>
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 001da6ecd2daefb440861c0f4ed9d154d62c46c3
Author: Alexey Khoroshilov <khoroshilov@ispras.ru>
Date:   Fri Mar 9 00:21:48 2018 +0300

    watchdog: sprd_wdt: Fix error handling in sprd_wdt_enable()
    
    [ Upstream commit 3c578cd4bc52b6e65d65be1abad9a8aa489ec207 ]
    
    If clk_prepare_enable(wdt->rtc_enable) fails,
    wdt->enable clock is left enabled.
    
    Found by Linux Driver Verification project (linuxtesting.org).
    
    Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit abf92f86361b562522155bec382d17ebb6e4c7a1
Author: Rafael J. Wysocki <rjw@rjwysocki.net>
Date:   Sat Mar 3 10:53:24 2018 +0100

    PCI: Restore config space on runtime resume despite being unbound
    
    [ Upstream commit 5775b843a619b3c93f946e2b55a208d9f0f48b59 ]
    
    We leave PCI devices not bound to a driver in D0 during runtime suspend.
    But they may have a parent which is bound and can be transitioned to
    D3cold at runtime.  Once the parent goes to D3cold, the unbound child
    may go to D3cold as well.  When the child goes to D3cold, its internal
    state, including configuration of BARs, MSI, ASPM, MPS, etc., is lost.
    
    One example are recent hybrid graphics laptops which cut power to the
    discrete GPU when the root port above it goes to ACPI power state D3.
    Users may provoke this by unbinding the GPU driver and allowing runtime
    PM on the GPU via sysfs:  The PM core will then treat the GPU as
    "suspended", which in turn allows the root port to runtime suspend,
    causing the power resources listed in its _PR3 object to be powered off.
    The GPU's BARs will be uninitialized when a driver later probes it.
    
    Another example are hybrid graphics laptops where the GPU itself (rather
    than the root port) is capable of runtime suspending to D3cold.  If the
    GPU's integrated HDA controller is not bound and the GPU's driver
    decides to runtime suspend to D3cold, the HDA controller's BARs will be
    uninitialized when a driver later probes it.
    
    Fix by saving and restoring config space over a runtime suspend cycle
    even if the device is not bound.
    
    Acked-by: Bjorn Helgaas <bhelgaas@google.com>
    Tested-by: Peter Wu <peter@lekensteyn.nl>              # Nvidia Optimus
    Tested-by: Lukas Wunner <lukas@wunner.de>              # MacBook Pro
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [lukas: add commit message, bikeshed code comments for clarity]
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/92fb6e6ae2730915eb733c08e2f76c6a313e3860.1520068884.git.lukas@wunner.de
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9bb3a5e6fec8f9c3c0326036bbfc5e530628424b
Author: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Date:   Fri Feb 9 11:49:06 2018 -0600

    powerpc/vas: Fix cleanup when VAS is not configured
    
    [ Upstream commit 45ddea8a73a25461387eb8e87f3e0ecca084799b ]
    
    When VAS is not configured, unregister the platform driver. Also simplify
    cleanup by delaying vas debugfs init until we know VAS is configured.
    
    Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5b042d2f8bfc1b10afa58f07f2bd0e15dbd27973
Author: Mathias Kresin <dev@kresin.me>
Date:   Thu May 11 08:18:24 2017 +0200

    MIPS: ath79: Fix AR724X_PLL_REG_PCIE_CONFIG offset
    
    [ Upstream commit 05454c1bde91fb013c0431801001da82947e6b5a ]
    
    According to the QCA u-boot source the "PCIE Phase Lock Loop
    Configuration (PCIE_PLL_CONFIG)" register is for all SoCs except the
    QCA955X and QCA956X at offset 0x10.
    
    Since the PCIE PLL config register is only defined for the AR724x fix
    only this value. The value is wrong since the day it was added and isn't
    used by any driver yet.
    
    Signed-off-by: Mathias Kresin <dev@kresin.me>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/16048/
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 87ef86818b702d135400a9dc9b46e0afe9a6f55f
Author: Ursula Braun <ubraun@linux.vnet.ibm.com>
Date:   Wed Mar 14 11:01:00 2018 +0100

    net/smc: pay attention to MAX_ORDER for CQ entries
    
    [ Upstream commit c9f4c6cf53bfafb639386a4c094929f13f573e04 ]
    
    smc allocates a certain number of CQ entries for used RoCE devices. For
    mlx5 devices the chosen constant number results in a large allocation
    causing this warning:
    
    [13355.124656] WARNING: CPU: 3 PID: 16535 at mm/page_alloc.c:3883 __alloc_pages_nodemask+0x2be/0x10c0
    [13355.124657] Modules linked in: smc_diag(O) smc(O) xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp bridge stp llc ip6table_filter ip6_tables iptable_filter mlx5_ib ib_core sunrpc mlx5_core s390_trng rng_core ghash_s390 prng aes_s390 des_s390 des_generic sha512_s390 sha256_s390 sha1_s390 sha_common ptp pps_core eadm_sch dm_multipath dm_mod vhost_net tun vhost tap sch_fq_codel kvm ip_tables x_tables autofs4 [last unloaded: smc]
    [13355.124672] CPU: 3 PID: 16535 Comm: kworker/3:0 Tainted: G           O    4.14.0uschi #1
    [13355.124673] Hardware name: IBM 3906 M04 704 (LPAR)
    [13355.124675] Workqueue: events smc_listen_work [smc]
    [13355.124677] task: 00000000e2f22100 task.stack: 0000000084720000
    [13355.124678] Krnl PSW : 0704c00180000000 000000000029da76 (__alloc_pages_nodemask+0x2be/0x10c0)
    [13355.124681]            R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
    [13355.124682] Krnl GPRS: 0000000000000000 00550e00014080c0 0000000000000000 0000000000000001
    [13355.124684]            000000000029d8b6 00000000f3bfd710 0000000000000000 00000000014080c0
    [13355.124685]            0000000000000009 00000000ec277a00 0000000000200000 0000000000000000
    [13355.124686]            0000000000000000 00000000000001ff 000000000029d8b6 0000000084723720
    [13355.124708] Krnl Code: 000000000029da6a: a7110200            tmll    %r1,512
                              000000000029da6e: a774ff29            brc     7,29d8c0
                             #000000000029da72: a7f40001            brc     15,29da74
                             >000000000029da76: a7f4ff25            brc     15,29d8c0
                              000000000029da7a: a7380000            lhi     %r3,0
                              000000000029da7e: a7f4fef1            brc     15,29d860
                              000000000029da82: 5820f0c4            l       %r2,196(%r15)
                              000000000029da86: a53e0048            llilh   %r3,72
    [13355.124720] Call Trace:
    [13355.124722] ([<000000000029d8b6>] __alloc_pages_nodemask+0xfe/0x10c0)
    [13355.124724]  [<000000000013bd1e>] s390_dma_alloc+0x6e/0x148
    [13355.124733]  [<000003ff802eeba6>] mlx5_dma_zalloc_coherent_node+0x8e/0xe0 [mlx5_core]
    [13355.124740]  [<000003ff802eee18>] mlx5_buf_alloc_node+0x70/0x108 [mlx5_core]
    [13355.124744]  [<000003ff804eb410>] mlx5_ib_create_cq+0x558/0x898 [mlx5_ib]
    [13355.124749]  [<000003ff80407d40>] ib_create_cq+0x48/0x88 [ib_core]
    [13355.124751]  [<000003ff80109fba>] smc_ib_setup_per_ibdev+0x52/0x118 [smc]
    [13355.124753]  [<000003ff8010bcb6>] smc_conn_create+0x65e/0x728 [smc]
    [13355.124755]  [<000003ff801081a2>] smc_listen_work+0x2d2/0x540 [smc]
    [13355.124756]  [<0000000000162c66>] process_one_work+0x1be/0x440
    [13355.124758]  [<0000000000162f40>] worker_thread+0x58/0x458
    [13355.124759]  [<0000000000169e7e>] kthread+0x14e/0x168
    [13355.124760]  [<00000000009ce8be>] kernel_thread_starter+0x6/0xc
    [13355.124762]  [<00000000009ce8b8>] kernel_thread_starter+0x0/0xc
    [13355.124762] Last Breaking-Event-Address:
    [13355.124764]  [<000000000029da72>] __alloc_pages_nodemask+0x2ba/0x10c0
    [13355.124764] ---[ end trace 34be38b581c0b585 ]---
    
    This patch reduces the smc constant for the maximum number of allocated
    completion queue entries SMC_MAX_CQE by 2 to avoid high round up values
    in the mlx5 code, and reduces the number of allocated completion queue
    entries even more, if the final allocation for an mlx5 device hits the
    MAX_ORDER limit.
    
    Reported-by: Ihnken Menssen <menssen@de.ibm.com>
    Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c2d500de999f3e2b3ce741a8474eeacfa623923e
Author: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Date:   Tue Mar 13 19:36:58 2018 +0100

    spi: bcm-qspi: fIX some error handling paths
    
    [ Upstream commit bc3cc75281b3c2b1c5355d88d147b66a753bb9a5 ]
    
    For some reason, commit c0368e4db4a3 ("spi: bcm-qspi: Fix use after free
    in bcm_qspi_probe() in error path") has updated some gotos, but not all of
    them.
    
    This looks spurious, so fix it.
    
    Fixes: fa236a7ef240 ("spi: bcm-qspi: Add Broadcom MSPI driver")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9880c68dd10bf2a2c9ca5731dd14658c1341cb6d
Author: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Date:   Tue Mar 13 21:33:11 2018 +0100

    regulator: gpio: Fix some error handling paths in 'gpio_regulator_probe()'
    
    [ Upstream commit ed8cffda27dea6fd3dafb3ee881c5a786edac9ca ]
    
    Re-order error handling code and gotos to avoid leaks in error handling
    paths.
    
    Fixes: 9f946099fe19 ("regulator: gpio: fix parsing of gpio list")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c3a8ca27139b955677b1832300e50bf8c3e15d26
Author: John Allen <jallen@linux.vnet.ibm.com>
Date:   Wed Mar 14 10:41:29 2018 -0500

    ibmvnic: Fix reset return from closed state
    
    [ Upstream commit e676d81c8990f511d60698a1a8abaa438b3f9d3d ]
    
    The case in which we handle a reset from the state where the device is
    closed seems to be bugged for all types of reset. For most types of reset
    we currently exit the reset routine correctly, but don't set the state to
    indicate that we are back in the "closed" state. For some specific cases,
    we don't exit the reset routine at all and resetting will cause a closed
    device to be opened.
    
    This patch fixes the problem by unconditionally checking the reset_state
    and correctly setting the adapter state before returning.
    
    Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d1130ade95d2eff09efdd880eebb29141110db98
Author: Leo Yan <leo.yan@linaro.org>
Date:   Tue Mar 13 11:24:30 2018 -0600

    coresight: Use %px to print pcsr instead of %p
    
    [ Upstream commit 831c326fcd0e8e2a6ece952f898a1ec9b1dc1004 ]
    
    Commit ad67b74d2469 ("printk: hash addresses printed with %p") lets
    printk specifier %p to hash all addresses before printing, this was
    resulting in the high 32 bits of pcsr can only output zeros.  So
    module cannot completely print pc value and it's pointless for debugging
    purpose.
    
    This patch fixes this by using %px to print pcsr instead.
    
    Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
    Signed-off-by: Leo Yan <leo.yan@linaro.org>
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b19bb9b610fd7740ce53795bba8978da2ec6a837
Author: Oded Gabbay <oded.gabbay@gmail.com>
Date:   Thu Mar 15 10:08:35 2018 +0200

    drm/amdkfd: add missing include of mm.h
    
    [ Upstream commit 7420f482ea5163bf6dae39a5c7628d5397cd6307 ]
    
    This patch fixes kernel build in ARCH=frv
    
    Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 93b6cb1760e798260c12b63af0dea648ea70ad50
Author: Parav Pandit <parav@mellanox.com>
Date:   Tue Mar 13 16:06:14 2018 +0200

    IB/core: Honor port_num while resolving GID for IB link layer
    
    [ Upstream commit 563c4ba3bd2b8b0b21c65669ec2226b1cfa1138b ]
    
    ah_attr contains the port number to which cm_id is bound. However, while
    searching for GID table for matching GID entry, the port number is
    ignored.
    
    This could cause the wrong GID to be used when the ah_attr is converted to
    an AH.
    
    Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
    Signed-off-by: Parav Pandit <parav@mellanox.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 86bddfd927fab27d9e139b449be76bca88fab09c
Author: Thomas Richter <tmricht@linux.vnet.ibm.com>
Date:   Thu Mar 8 15:57:35 2018 +0100

    perf stat: Fix core dump when flag T is used
    
    [ Upstream commit fca32340a5e8b896f57d41fd94b8b1701df25eb1 ]
    
    Executing command 'perf stat -T -- ls' dumps core on x86 and s390.
    
    Here is the call back chain (done on x86):
    
     # gdb ./perf
     ....
     (gdb) r stat -T -- ls
    ...
    Program received signal SIGSEGV, Segmentation fault.
    0x00007ffff56d1963 in vasprintf () from /lib64/libc.so.6
    (gdb) where
     #0  0x00007ffff56d1963 in vasprintf () from /lib64/libc.so.6
     #1  0x00007ffff56ae484 in asprintf () from /lib64/libc.so.6
     #2  0x00000000004f1982 in __parse_events_add_pmu (parse_state=0x7fffffffd580,
        list=0xbfb970, name=0xbf3ef0 "cpu",
        head_config=0xbfb930, auto_merge_stats=false) at util/parse-events.c:1233
     #3  0x00000000004f1c8e in parse_events_add_pmu (parse_state=0x7fffffffd580,
        list=0xbfb970, name=0xbf3ef0 "cpu",
        head_config=0xbfb930) at util/parse-events.c:1288
     #4  0x0000000000537ce3 in parse_events_parse (_parse_state=0x7fffffffd580,
        scanner=0xbf4210) at util/parse-events.y:234
     #5  0x00000000004f2c7a in parse_events__scanner (str=0x6b66c0
        "task-clock,{instructions,cycles,cpu/cycles-t/,cpu/tx-start/}",
        parse_state=0x7fffffffd580, start_token=258) at util/parse-events.c:1673
     #6  0x00000000004f2e23 in parse_events (evlist=0xbe9990, str=0x6b66c0
        "task-clock,{instructions,cycles,cpu/cycles-t/,cpu/tx-start/}", err=0x0)
        at util/parse-events.c:1713
     #7  0x000000000044e137 in add_default_attributes () at builtin-stat.c:2281
     #8  0x000000000044f7b5 in cmd_stat (argc=1, argv=0x7fffffffe3b0) at
        builtin-stat.c:2828
     #9  0x00000000004c8b0f in run_builtin (p=0xab01a0 <commands+288>, argc=4,
        argv=0x7fffffffe3b0) at perf.c:297
     #10 0x00000000004c8d7c in handle_internal_command (argc=4,
        argv=0x7fffffffe3b0) at perf.c:349
     #11 0x00000000004c8ece in run_argv (argcp=0x7fffffffe20c,
       argv=0x7fffffffe200) at perf.c:393
     #12 0x00000000004c929c in main (argc=4, argv=0x7fffffffe3b0) at perf.c:537
    (gdb)
    
    It turns out that a NULL pointer is referenced. Here are the
    function calls:
    
      ...
      cmd_stat()
      +---> add_default_attributes()
            +---> parse_events(evsel_list, transaction_attrs, NULL);
                         3rd parameter set to NULL
    
    Function parse_events(xx, xx, struct parse_events_error *err) dives
    into a bison generated scanner and creates
    parser state information for it first:
    
       struct parse_events_state parse_state = {
                    .list   = LIST_HEAD_INIT(parse_state.list),
                    .idx    = evlist->nr_entries,
                    .error  = err,   <--- NULL POINTER !!!
                    .evlist = evlist,
            };
    
    Now various functions inside the bison scanner are called to end up in
    __parse_events_add_pmu(struct parse_events_state *parse_state, ..) with
    first parameter being a pointer to above structure definition.
    
    Now the PMU event name is not found (because being executed in a VM) and
    this function tries to create an error message with
    
       asprintf(&parse_state->error.str, ....)
    
    which references a NULL pointer and dumps core.
    
    Fix this by providing a pointer to the necessary error information
    instead of NULL. Technically only the else part is needed to avoid the
    core dump, just lets be safe...
    
    Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
    Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
    Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
    Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
    Link: http://lkml.kernel.org/r/20180308145735.64717-1-tmricht@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0fcaef981346e6478514bcb6ad3ef7dfd0c3a4a5
Author: Yisheng Xie <xieyisheng1@huawei.com>
Date:   Mon Mar 12 19:25:56 2018 +0800

    perf top: Fix top.call-graph config option reading
    
    [ Upstream commit a3a4a3b37c9b911af4c375b2475cea0fd2b84d38 ]
    
    When trying to add the "call-graph" variable for top into the
    .perfconfig file, like:
    
          [top]
                call-graph = fp
    
    I that perf_top_config() do not parse this variable.
    
    Fix it by calling perf_default_config() when the top.call-graph variable
    is set.
    
    Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
    Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Fixes: b8cbb349061e ("perf config: Bring perf_default_config to the very beginning at main()")
    Link: http://lkml.kernel.org/r/1520853957-36106-1-git-send-email-xieyisheng1@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 532d994f1669a2ad918b60cc6d4a60c534b8006a
Author: Vitaly Kuznetsov <vkuznets@redhat.com>
Date:   Fri Feb 9 14:01:33 2018 +0100

    KVM: lapic: stop advertising DIRECTED_EOI when in-kernel IOAPIC is in use
    
    [ Upstream commit 0bcc3fb95b97ac2ca223a5a870287b37f56265ac ]
    
    Devices which use level-triggered interrupts under Windows 2016 with
    Hyper-V role enabled don't work: Windows disables EOI broadcast in SPIV
    unconditionally. Our in-kernel IOAPIC implementation emulates an old IOAPIC
    version which has no EOI register so EOI never happens.
    
    The issue was discovered and discussed a while ago:
    https://www.spinics.net/lists/kvm/msg148098.html
    
    While this is a guest OS bug (it should check that IOAPIC has the required
    capabilities before disabling EOI broadcast) we can workaround it in KVM:
    advertising DIRECTED_EOI with in-kernel IOAPIC makes little sense anyway.
    
    Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
    Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 46535019c9ecda485288799eedb608d46b0c9817
Author: Gregory CLEMENT <gregory.clement@bootlin.com>
Date:   Wed Mar 14 18:03:40 2018 +0100

    i2c: mv64xxx: Apply errata delay only in standard mode
    
    [ Upstream commit 31184d8c6ea49ea0676d100cdd7e1f102ad025b5 ]
    
    The errata FE-8471889 description has been updated. There is still a
    timing violation for repeated start. But the errata now states that it
    was only the case for the Standard mode (100 kHz), in Fast mode (400 kHz)
    there is no issue.
    
    This patch limit the errata fix to the Standard mode.
    
    It has been tesed successfully on the clearfog (Aramda 388 based board).
    
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e460fd625626169104e322f729c0e81f363c147c
Author: Arjun Vynipadath <arjun@chelsio.com>
Date:   Thu Mar 15 17:34:14 2018 +0530

    cxgb4: Fix queue free path of ULD drivers
    
    [ Upstream commit d7cb44496a9bb458632cb3c18acb08949c210448 ]
    
    Setting sge_uld_rxq_info to NULL in free_queues_uld().
    We are referencing sge_uld_rxq_info in cxgb_up(). This
    will fix a panic when interface is brought up after a
    ULDq creation failure.
    
    Fixes: 94cdb8bb993a (cxgb4: Add support for dynamic allocation
           of resources for ULD)
    Signed-off-by: Arjun Vynipadath <arjun@chelsio.com>
    Signed-off-by: Casey Leedom <leedom@chelsio.com>
    Signed-off-by: Ganesh Goudhar <ganeshgr@chelsio.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1313bbe2d4a7dfd1fc503a2a9b7af4c88e2f68ec
Author: Seunghun Han <kkamagui@gmail.com>
Date:   Wed Mar 14 16:12:56 2018 -0700

    ACPICA: acpi: acpica: fix acpi operand cache leak in nseval.c
    
    [ Upstream commit 97f3c0a4b0579b646b6b10ae5a3d59f0441cc12c ]
    
    I found an ACPI cache leak in ACPI early termination and boot continuing case.
    
    When early termination occurs due to malicious ACPI table, Linux kernel
    terminates ACPI function and continues to boot process. While kernel terminates
    ACPI function, kmem_cache_destroy() reports Acpi-Operand cache leak.
    
    Boot log of ACPI operand cache leak is as follows:
    >[    0.464168] ACPI: Added _OSI(Module Device)
    >[    0.467022] ACPI: Added _OSI(Processor Device)
    >[    0.469376] ACPI: Added _OSI(3.0 _SCP Extensions)
    >[    0.471647] ACPI: Added _OSI(Processor Aggregator Device)
    >[    0.477997] ACPI Error: Null stack entry at ffff880215c0aad8 (20170303/exresop-174)
    >[    0.482706] ACPI Exception: AE_AML_INTERNAL, While resolving operands for [opcode_name unavailable] (20170303/dswexec-461)
    >[    0.487503] ACPI Error: Method parse/execution failed [\DBG] (Node ffff88021710ab40), AE_AML_INTERNAL (20170303/psparse-543)
    >[    0.492136] ACPI Error: Method parse/execution failed [\_SB._INI] (Node ffff88021710a618), AE_AML_INTERNAL (20170303/psparse-543)
    >[    0.497683] ACPI: Interpreter enabled
    >[    0.499385] ACPI: (supports S0)
    >[    0.501151] ACPI: Using IOAPIC for interrupt routing
    >[    0.503342] ACPI Error: Null stack entry at ffff880215c0aad8 (20170303/exresop-174)
    >[    0.506522] ACPI Exception: AE_AML_INTERNAL, While resolving operands for [opcode_name unavailable] (20170303/dswexec-461)
    >[    0.510463] ACPI Error: Method parse/execution failed [\DBG] (Node ffff88021710ab40), AE_AML_INTERNAL (20170303/psparse-543)
    >[    0.514477] ACPI Error: Method parse/execution failed [\_PIC] (Node ffff88021710ab18), AE_AML_INTERNAL (20170303/psparse-543)
    >[    0.518867] ACPI Exception: AE_AML_INTERNAL, Evaluating _PIC (20170303/bus-991)
    >[    0.522384] kmem_cache_destroy Acpi-Operand: Slab cache still has objects
    >[    0.524597] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.12.0-rc5 #26
    >[    0.526795] Hardware name: innotek gmb_h virtual_box/virtual_box, BIOS virtual_box 12/01/2006
    >[    0.529668] Call Trace:
    >[    0.530811]  ? dump_stack+0x5c/0x81
    >[    0.532240]  ? kmem_cache_destroy+0x1aa/0x1c0
    >[    0.533905]  ? acpi_os_delete_cache+0xa/0x10
    >[    0.535497]  ? acpi_ut_delete_caches+0x3f/0x7b
    >[    0.537237]  ? acpi_terminate+0xa/0x14
    >[    0.538701]  ? acpi_init+0x2af/0x34f
    >[    0.540008]  ? acpi_sleep_proc_init+0x27/0x27
    >[    0.541593]  ? do_one_initcall+0x4e/0x1a0
    >[    0.543008]  ? kernel_init_freeable+0x19e/0x21f
    >[    0.546202]  ? rest_init+0x80/0x80
    >[    0.547513]  ? kernel_init+0xa/0x100
    >[    0.548817]  ? ret_from_fork+0x25/0x30
    >[    0.550587] vgaarb: loaded
    >[    0.551716] EDAC MC: Ver: 3.0.0
    >[    0.553744] PCI: Probing PCI hardware
    >[    0.555038] PCI host bridge to bus 0000:00
    > ... Continue to boot and log is omitted ...
    
    I analyzed this memory leak in detail and found acpi_ns_evaluate() function
    only removes Info->return_object in AE_CTRL_RETURN_VALUE case. But, when errors
    occur, the status value is not AE_CTRL_RETURN_VALUE, and Info->return_object is
    also not null. Therefore, this causes acpi operand memory leak.
    
    This cache leak causes a security threat because an old kernel (<= 4.9) shows
    memory locations of kernel functions in stack dump. Some malicious users
    could use this information to neutralize kernel ASLR.
    
    I made a patch to fix ACPI operand cache leak.
    
    Signed-off-by: Seunghun Han <kkamagui@gmail.com>
    Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3e0c5afc6017d5ac3db62f42eb2a5cd8d6830124
Author: Coly Li <colyli@suse.de>
Date:   Sun Mar 18 17:36:16 2018 -0700

    bcache: stop dc->writeback_rate_update properly
    
    [ Upstream commit 3fd47bfe55b00d5ac7b0a44c9301c07be39b1082 ]
    
    struct delayed_work writeback_rate_update in struct cache_dev is a delayed
    worker to call function update_writeback_rate() in period (the interval is
    defined by dc->writeback_rate_update_seconds).
    
    When a metadate I/O error happens on cache device, bcache error handling
    routine bch_cache_set_error() will call bch_cache_set_unregister() to
    retire whole cache set. On the unregister code path, this delayed work is
    stopped by calling cancel_delayed_work_sync(&dc->writeback_rate_update).
    
    dc->writeback_rate_update is a special delayed work from others in bcache.
    In its routine update_writeback_rate(), this delayed work is re-armed
    itself. That means when cancel_delayed_work_sync() returns, this delayed
    work can still be executed after several seconds defined by
    dc->writeback_rate_update_seconds.
    
    The problem is, after cancel_delayed_work_sync() returns, the cache set
    unregister code path will continue and release memory of struct cache set.
    Then the delayed work is scheduled to run, __update_writeback_rate()
    will reference the already released cache_set memory, and trigger a NULL
    pointer deference fault.
    
    This patch introduces two more bcache device flags,
    - BCACHE_DEV_WB_RUNNING
      bit set:  bcache device is in writeback mode and running, it is OK for
                dc->writeback_rate_update to re-arm itself.
      bit clear:bcache device is trying to stop dc->writeback_rate_update,
                this delayed work should not re-arm itself and quit.
    - BCACHE_DEV_RATE_DW_RUNNING
      bit set:  routine update_writeback_rate() is executing.
      bit clear: routine update_writeback_rate() quits.
    
    This patch also adds a function cancel_writeback_rate_update_dwork() to
    wait for dc->writeback_rate_update quits before cancel it by calling
    cancel_delayed_work_sync(). In order to avoid a deadlock by unexpected
    quit dc->writeback_rate_update, after time_out seconds this function will
    give up and continue to call cancel_delayed_work_sync().
    
    And here I explain how this patch stops self re-armed delayed work properly
    with the above stuffs.
    
    update_writeback_rate() sets BCACHE_DEV_RATE_DW_RUNNING at its beginning
    and clears BCACHE_DEV_RATE_DW_RUNNING at its end. Before calling
    cancel_writeback_rate_update_dwork() clear flag BCACHE_DEV_WB_RUNNING.
    
    Before calling cancel_delayed_work_sync() wait utill flag
    BCACHE_DEV_RATE_DW_RUNNING is clear. So when calling
    cancel_delayed_work_sync(), dc->writeback_rate_update must be already re-
    armed, or quite by seeing BCACHE_DEV_WB_RUNNING cleared. In both cases
    delayed work routine update_writeback_rate() won't be executed after
    cancel_delayed_work_sync() returns.
    
    Inside update_writeback_rate() before calling schedule_delayed_work(), flag
    BCACHE_DEV_WB_RUNNING is checked before. If this flag is cleared, it means
    someone is about to stop the delayed work. Because flag
    BCACHE_DEV_RATE_DW_RUNNING is set already and cancel_delayed_work_sync()
    has to wait for this flag to be cleared, we don't need to worry about race
    condition here.
    
    If update_writeback_rate() is scheduled to run after checking
    BCACHE_DEV_RATE_DW_RUNNING and before calling cancel_delayed_work_sync()
    in cancel_writeback_rate_update_dwork(), it is also safe. Because at this
    moment BCACHE_DEV_WB_RUNNING is cleared with memory barrier. As I mentioned
    previously, update_writeback_rate() will see BCACHE_DEV_WB_RUNNING is clear
    and quit immediately.
    
    Because there are more dependences inside update_writeback_rate() to struct
    cache_set memory, dc->writeback_rate_update is not a simple self re-arm
    delayed work. After trying many different methods (e.g. hold dc->count, or
    use locks), this is the only way I can find which works to properly stop
    dc->writeback_rate_update delayed work.
    
    Changelog:
    v3: change values of BCACHE_DEV_WB_RUNNING and BCACHE_DEV_RATE_DW_RUNNING
        to bit index, for test_bit().
    v2: Try to fix the race issue which is pointed out by Junhui.
    v1: The initial version for review
    
    Signed-off-by: Coly Li <colyli@suse.de>
    Reviewed-by: Junhui Tang <tang.junhui@zte.com.cn>
    Reviewed-by: Michael Lyle <mlyle@lyle.org>
    Cc: Michael Lyle <mlyle@lyle.org>
    Cc: Hannes Reinecke <hare@suse.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a4beec03961bf93895448ac44853a80f34420d64
Author: Bob Moore <robert.moore@intel.com>
Date:   Wed Mar 14 16:13:01 2018 -0700

    ACPICA: Fix memory leak on unusual memory leak
    
    [ Upstream commit 1c29c372b2d1d2415601041532745ce859f24126 ]
    
    Fixes a single-object memory leak on a store-to-reference method
    invocation. ACPICA BZ 1439.
    
    Signed-off-by: Bob Moore <robert.moore@intel.com>
    Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5dd2c7a02f98847c5172cce320e19ea0d3841f7d
Author: Erik Schmauss <erik.schmauss@intel.com>
Date:   Wed Mar 14 16:13:08 2018 -0700

    ACPICA: Events: add a return on failure from acpi_hw_register_read
    
    [ Upstream commit b4c0de312613ca676db5bd7e696a44b56795612a ]
    
    This ensures that acpi_ev_fixed_event_detect() does not use fixed_status
    and and fixed_enable as uninitialized variables.
    
    Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f4cb7e281be230185c049436e5c45b57a58d6fa2
Author: Coly Li <colyli@suse.de>
Date:   Sun Mar 18 17:36:14 2018 -0700

    bcache: fix cached_dev->count usage for bch_cache_set_error()
    
    [ Upstream commit 804f3c6981f5e4a506a8f14dc284cb218d0659ae ]
    
    When bcache metadata I/O fails, bcache will call bch_cache_set_error()
    to retire the whole cache set. The expected behavior to retire a cache
    set is to unregister the cache set, and unregister all backing device
    attached to this cache set, then remove sysfs entries of the cache set
    and all attached backing devices, finally release memory of structs
    cache_set, cache, cached_dev and bcache_device.
    
    In my testing when journal I/O failure triggered by disconnected cache
    device, sometimes the cache set cannot be retired, and its sysfs
    entry /sys/fs/bcache/<uuid> still exits and the backing device also
    references it. This is not expected behavior.
    
    When metadata I/O failes, the call senquence to retire whole cache set is,
            bch_cache_set_error()
            bch_cache_set_unregister()
            bch_cache_set_stop()
            __cache_set_unregister()     <- called as callback by calling
                                            clousre_queue(&c->caching)
            cache_set_flush()            <- called as a callback when refcount
                                            of cache_set->caching is 0
            cache_set_free()             <- called as a callback when refcount
                                            of catch_set->cl is 0
            bch_cache_set_release()      <- called as a callback when refcount
                                            of catch_set->kobj is 0
    
    I find if kernel thread bch_writeback_thread() quits while-loop when
    kthread_should_stop() is true and searched_full_index is false, clousre
    callback cache_set_flush() set by continue_at() will never be called. The
    result is, bcache fails to retire whole cache set.
    
    cache_set_flush() will be called when refcount of closure c->caching is 0,
    and in function bcache_device_detach() refcount of closure c->caching is
    released to 0 by clousre_put(). In metadata error code path, function
    bcache_device_detach() is called by cached_dev_detach_finish(). This is a
    callback routine being called when cached_dev->count is 0. This refcount
    is decreased by cached_dev_put().
    
    The above dependence indicates, cache_set_flush() will be called when
    refcount of cache_set->cl is 0, and refcount of cache_set->cl to be 0
    when refcount of cache_dev->count is 0.
    
    The reason why sometimes cache_dev->count is not 0 (when metadata I/O fails
    and bch_cache_set_error() called) is, in bch_writeback_thread(), refcount
    of cache_dev is not decreased properly.
    
    In bch_writeback_thread(), cached_dev_put() is called only when
    searched_full_index is true and cached_dev->writeback_keys is empty, a.k.a
    there is no dirty data on cache. In most of run time it is correct, but
    when bch_writeback_thread() quits the while-loop while cache is still
    dirty, current code forget to call cached_dev_put() before this kernel
    thread exits. This is why sometimes cache_set_flush() is not executed and
    cache set fails to be retired.
    
    The reason to call cached_dev_put() in bch_writeback_rate() is, when the
    cache device changes from clean to dirty, cached_dev_get() is called, to
    make sure during writeback operatiions both backing and cache devices
    won't be released.
    
    Adding following code in bch_writeback_thread() does not work,
       static int bch_writeback_thread(void *arg)
            }
    
    +       if (atomic_read(&dc->has_dirty))
    +               cached_dev_put()
    +
            return 0;
     }
    because writeback kernel thread can be waken up and start via sysfs entry:
            echo 1 > /sys/block/bcache<N>/bcache/writeback_running
    It is difficult to check whether backing device is dirty without race and
    extra lock. So the above modification will introduce potential refcount
    underflow in some conditions.
    
    The correct fix is, to take cached dev refcount when creating the kernel
    thread, and put it before the kernel thread exits. Then bcache does not
    need to take a cached dev refcount when cache turns from clean to dirty,
    or to put a cached dev refcount when cache turns from ditry to clean. The
    writeback kernel thread is alwasy safe to reference data structure from
    cache set, cache and cached device (because a refcount of cache device is
    taken for it already), and no matter the kernel thread is stopped by I/O
    errors or system reboot, cached_dev->count can always be used correctly.
    
    The patch is simple, but understanding how it works is quite complicated.
    
    Changelog:
    v2: set dc->writeback_thread to NULL in this patch, as suggested by Hannes.
    v1: initial version for review.
    
    Signed-off-by: Coly Li <colyli@suse.de>
    Reviewed-by: Hannes Reinecke <hare@suse.com>
    Reviewed-by: Michael Lyle <mlyle@lyle.org>
    Cc: Michael Lyle <mlyle@lyle.org>
    Cc: Junhui Tang <tang.junhui@zte.com.cn>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 39c9acb37fcce825545ca7fd2c919739fffdb657
Author: Icenowy Zheng <icenowy@aosc.io>
Date:   Fri Mar 16 22:02:12 2018 +0800

    dt-bindings: add device tree binding for Allwinner H6 main CCU
    
    [ Upstream commit 2e08e4d2ff488424919d69dd211ac860a019ac1d ]
    
    The Allwinner H6 main CCU uses the internal oscillator of the SoC, which
    is different with old SoCs' main CCU.
    
    Add device tree binding for the Allwinner H6 main CCU.
    
    Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
    Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3599f6e712ab364c12fe17553ce74ff2b998e13f
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Wed Mar 14 20:56:37 2018 +0100

    remoteproc: imx_rproc: Fix an error handling path in 'imx_rproc_probe()'
    
    [ Upstream commit de6f83f85be94e0b7d0d324c29ccc9d78a6bb4e7 ]
    
    If 'of_device_get_match_data()' fails, we must undo the previous
    'rproc_alloc()' call.
    
    Fixes: a0ff4aa6f010 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dc59d205a380bcdcd63103a929281334b4c9923a
Author: Coly Li <colyli@suse.de>
Date:   Sun Mar 18 17:36:15 2018 -0700

    bcache: quit dc->writeback_thread when BCACHE_DEV_DETACHING is set
    
    [ Upstream commit fadd94e05c02afec7b70b0b14915624f1782f578 ]
    
    In patch "bcache: fix cached_dev->count usage for bch_cache_set_error()",
    cached_dev_get() is called when creating dc->writeback_thread, and
    cached_dev_put() is called when exiting dc->writeback_thread. This
    modification works well unless people detach the bcache device manually by
        'echo 1 > /sys/block/bcache<N>/bcache/detach'
    Because this sysfs interface only calls bch_cached_dev_detach() which wakes
    up dc->writeback_thread but does not stop it. The reason is, before patch
    "bcache: fix cached_dev->count usage for bch_cache_set_error()", inside
    bch_writeback_thread(), if cache is not dirty after writeback,
    cached_dev_put() will be called here. And in cached_dev_make_request() when
    a new write request makes cache from clean to dirty, cached_dev_get() will
    be called there. Since we don't operate dc->count in these locations,
    refcount d->count cannot be dropped after cache becomes clean, and
    cached_dev_detach_finish() won't be called to detach bcache device.
    
    This patch fixes the issue by checking whether BCACHE_DEV_DETACHING is
    set inside bch_writeback_thread(). If this bit is set and cache is clean
    (no existing writeback_keys), break the while-loop, call cached_dev_put()
    and quit the writeback thread.
    
    Please note if cache is still dirty, even BCACHE_DEV_DETACHING is set the
    writeback thread should continue to perform writeback, this is the original
    design of manually detach.
    
    It is safe to do the following check without locking, let me explain why,
    +       if (!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) &&
    +           (!atomic_read(&dc->has_dirty) || !dc->writeback_running)) {
    
    If the kenrel thread does not sleep and continue to run due to conditions
    are not updated in time on the running CPU core, it just consumes more CPU
    cycles and has no hurt. This should-sleep-but-run is safe here. We just
    focus on the should-run-but-sleep condition, which means the writeback
    thread goes to sleep in mistake while it should continue to run.
    1, First of all, no matter the writeback thread is hung or not,
       kthread_stop() from cached_dev_detach_finish() will wake up it and
       terminate by making kthread_should_stop() return true. And in normal
       run time, bit on index BCACHE_DEV_DETACHING is always cleared, the
       condition
            !test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)
       is always true and can be ignored as constant value.
    2, If one of the following conditions is true, the writeback thread should
       go to sleep,
       "!atomic_read(&dc->has_dirty)" or "!dc->writeback_running)"
       each of them independently controls the writeback thread should sleep or
       not, let's analyse them one by one.
    2.1 condition "!atomic_read(&dc->has_dirty)"
       If dc->has_dirty is set from 0 to 1 on another CPU core, bcache will
       call bch_writeback_queue() immediately or call bch_writeback_add() which
       indirectly calls bch_writeback_queue() too. In bch_writeback_queue(),
       wake_up_process(dc->writeback_thread) is called. It sets writeback
       thread's task state to TASK_RUNNING and following an implicit memory
       barrier, then tries to wake up the writeback thread.
       In writeback thread, its task state is set to TASK_INTERRUPTIBLE before
       doing the condition check. If other CPU core sets the TASK_RUNNING state
       after writeback thread setting TASK_INTERRUPTIBLE, the writeback thread
       will be scheduled to run very soon because its state is not
       TASK_INTERRUPTIBLE. If other CPU core sets the TASK_RUNNING state before
       writeback thread setting TASK_INTERRUPTIBLE, the implict memory barrier
       of wake_up_process() will make sure modification of dc->has_dirty on
       other CPU core is updated and observed on the CPU core of writeback
       thread. Therefore the condition check will correctly be false, and
       continue writeback code without sleeping.
    2.2 condition "!dc->writeback_running)"
       dc->writeback_running can be changed via sysfs file, every time it is
       modified, a following bch_writeback_queue() is alwasy called. So the
       change is always observed on the CPU core of writeback thread. If
       dc->writeback_running is changed from 0 to 1 on other CPU core, this
       condition check will observe the modification and allow writeback
       thread to continue to run without sleeping.
    Now we can see, even without a locking protection, multiple conditions
    check is safe here, no deadlock or process hang up will happen.
    
    I compose a separte patch because that patch "bcache: fix cached_dev->count
    usage for bch_cache_set_error()" already gets a "Reviewed-by:" from Hannes
    Reinecke. Also this fix is not trivial and good for a separate patch.
    
    Signed-off-by: Coly Li <colyli@suse.de>
    Reviewed-by: Michael Lyle <mlyle@lyle.org>
    Cc: Hannes Reinecke <hare@suse.com>
    Cc: Huijun Tang <tang.junhui@zte.com.cn>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6baf3765582dc7cef9ca026fff628a5053de3bea
Author: Michael Schmitz <schmitzmic@gmail.com>
Date:   Sat Mar 3 12:04:13 2018 +1300

    zorro: Set up z->dev.dma_mask for the DMA API
    
    [ Upstream commit 55496d3fe2acd1a365c43cbd613a20ecd4d74395 ]
    
    The generic DMA API uses dev->dma_mask to check the DMA addressable
    memory bitmask, and warns if no mask is set or even allocated.
    
    Set z->dev.dma_coherent_mask on Zorro bus scan, and make z->dev.dma_mask
    to point to z->dev.dma_coherent_mask so device drivers that need DMA have
    everything set up to avoid warnings from dma_alloc_coherent(). Drivers can
    still use dma_set_mask_and_coherent() to explicitly set their DMA bit mask.
    
    Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
    [geert: Handle Zorro II with 24-bit address space]
    Acked-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cf4d94149ef38c9d9c07f5b01c3aa2c637a6aefb
Author: Honggang Li <honli@redhat.com>
Date:   Fri Mar 16 10:37:13 2018 +0800

    IB/mlx5: Set the default active rate and width to QDR and 4X
    
    [ Upstream commit 7672ed33c4c15dbe9d56880683baaba4227cf940 ]
    
    Before commit f1b65df5a232 ("IB/mlx5: Add support for active_width and
    active_speed in RoCE"), the mlx5_ib driver set the default active_width
    and active_speed to IB_WIDTH_4X and IB_SPEED_QDR.
    
    When the RoCE port is down, the RoCE port does not negotiate the active
    width with the remote side, causing the active width to be zero. When
    running userspace ibstat to view the port status, ibstat will panic as it
    reads an invalid width from sys file.
    
    This patch restores the original behavior.
    
    Fixes: f1b65df5a232 ("IB/mlx5: Add support for active_width and active_speed in RoCE").
    Signed-off-by: Honggang Li <honli@redhat.com>
    Reviewed-by: Hal Rosenstock <hal@mellanox.com>
    Reviewed-by: Noa Osherovich <noaos@mellanox.com>
    Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fad3168d229a1cb5deba572834d1c61de715d229
Author: Luis R. Rodriguez <mcgrof@kernel.org>
Date:   Sat Mar 10 06:14:56 2018 -0800

    firmware: fix checking for return values for fw_add_devm_name()
    
    [ Upstream commit d15d7311550983be97dca44ad68cbc2ca001297b ]
    
    Currently fw_add_devm_name() returns 1 if the firmware cache
    was already set. This makes it complicated for us to check for
    correctness. It is actually non-fatal if the firmware cache
    is already setup, so just return 0, and simplify the checkers.
    
    fw_add_devm_name() adds device's name onto the devres for the
    device so that prior to suspend we cache the firmware onto memory,
    so that on resume the firmware is reliably available. We never
    were checking for success for this call though, meaning in some
    really rare cases we my have never setup the firmware cache for
    a device, which could in turn make resume fail.
    
    This is all theoretical, no known issues have been reported.
    This small issue has been present way since the addition of the
    devres firmware cache names on v3.7.
    
    Fixes: f531f05ae9437 ("firmware loader: store firmware name into devres list")
    Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d7187e44f3d915f7f8e45ac16d80b270f1754f64
Author: Chunyu Hu <chuhu@redhat.com>
Date:   Mon Mar 5 13:40:38 2018 +0800

    cpufreq: cppc_cpufreq: Fix cppc_cpufreq_init() failure path
    
    [ Upstream commit 55b55abc17f238c61921360e61dde90dd9a326d1 ]
    
    Kmemleak reported the below leak. When cppc_cpufreq_init went into
    failure path, the cpu mask is not freed. After fix, this report is
    gone. And to avaoid potential NULL pointer reference, check the cpu
    value first.
    
    unreferenced object 0xffff800fd5ea4880 (size 128):
      comm "swapper/0", pid 1, jiffies 4294939510 (age 668.680s)
      hex dump (first 32 bytes):
        00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00  .... ...........
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
        [<ffff0000082c4ae4>] __kmalloc_node+0x278/0x634
        [<ffff0000088f4a74>] alloc_cpumask_var_node+0x28/0x60
        [<ffff0000088f4af0>] zalloc_cpumask_var+0x14/0x1c
        [<ffff000008d20254>] cppc_cpufreq_init+0xd0/0x19c
        [<ffff000008083828>] do_one_initcall+0xec/0x15c
        [<ffff000008cd1018>] kernel_init_freeable+0x1f4/0x2a4
        [<ffff0000089099b0>] kernel_init+0x18/0x10c
        [<ffff000008084d50>] ret_from_fork+0x10/0x18
        [<ffffffffffffffff>] 0xffffffffffffffff
    
    Signed-off-by: Chunyu Hu <chuhu@redhat.com>
    Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 356e265668170a03a99ca8fd0e0ae5f609ce4171
Author: Yong Wu <yong.wu@mediatek.com>
Date:   Sun Mar 18 09:52:54 2018 +0800

    iommu/mediatek: Fix protect memory setting
    
    [ Upstream commit 70ca608b2ec6dafa6bb1c2b0691852fc78f8f717 ]
    
    In MediaTek's IOMMU design, When a iommu translation fault occurs
    (HW can NOT translate the destination address to a valid physical
    address), the IOMMU HW output the dirty data into a special memory
    to avoid corrupting the main memory, this is called "protect memory".
    the register(0x114) for protect memory is a little different between
    mt8173 and mt2712.
    
    In the mt8173, bit[30:6] in the register represents [31:7] of the
    physical address. In the 4GB mode, the register bit[31] should be 1.
    While in the mt2712, the bits don't shift. bit[31:7] in the register
    represents [31:7] in the physical address, and bit[1:0] in the
    register represents bit[33:32] of the physical address if it has.
    
    Fixes: e6dec9230862 ("iommu/mediatek: Add mt2712 IOMMU support")
    Reported-by: Honghui Zhang <honghui.zhang@mediatek.com>
    Signed-off-by: Yong Wu <yong.wu@mediatek.com>
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6a2360b2d0ac3b3dc4c6e1d9a2e613d41d61e1ce
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Thu Mar 22 10:35:18 2018 +0100

    drm/vmwgfx: Unpin the screen object backup buffer when not used
    
    [ Upstream commit 20fb5a635a0c8478ac98f15cfafc2ea83df29565 ]
    
    We were relying on the pinned screen object backup buffer to be destroyed
    when not used. But if we hold a copy of the atomic state, like when
    hibernating, the backup buffer might not be destroyed since it's
    refcounted by the atomic state. This causes us to hibernate with a
    buffer pinned in VRAM.
    
    Fix this by only having the buffer pinned when it is actually used by a
    screen object.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    Reviewed-by: Sinclair Yeh <syeh@vmware.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 17512079fe0b94dbe42f2ae44bfeb93d8b9aba5d
Author: Eric Sandeen <sandeen@redhat.com>
Date:   Thu Mar 22 11:59:00 2018 -0400

    ext4: don't complain about incorrect features when probing
    
    [ Upstream commit 0d9366d67bcf066b028e57d09c9a86ce879bcc28 ]
    
    If mount is auto-probing for filesystem type, it will try various
    filesystems in order, with the MS_SILENT flag set.  We get
    that flag as the silent arg to ext4_fill_super.
    
    If we're probing (silent==1) then don't complain about feature
    incompatibilities that are found if it looks like it's actually
    a different valid extN type - failed probes should be silent
    in this case.
    
    If the on-disk features are unknown even to ext4, then complain.
    
    Reported-by: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
    Tested-by: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
    Signed-off-by: Eric Sandeen <sandeen@redhat.com>
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 67fc206d73936d979d587345208207a7c262b482
Author: Mimi Zohar <zohar@linux.vnet.ibm.com>
Date:   Sat Mar 10 23:07:34 2018 -0500

    ima: clear IMA_HASH
    
    [ Upstream commit a9a4935d44b58c858a81393694bc232a96cdcbd4 ]
    
    The IMA_APPRAISE and IMA_HASH policies overlap. Clear IMA_HASH properly.
    
    Fixes: da1b0029f527 ("ima: support new "hash" and "dont_hash" policy actions")
    Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3f4bd1f95b7e43c16888333c9fb7135ce7fbbc92
Author: Philipp Puschmann <pp@emlix.com>
Date:   Fri Mar 23 10:22:15 2018 +0100

    arm: dts: socfpga: fix GIC PPI warning
    
    [ Upstream commit 6d97d5aba08b26108f95dc9fb7bbe4d9436c769c ]
    
    Fixes the warning "GIC: PPI13 is secure or misconfigured" by
    changing the interrupt type from level_low to edge_raising
    
    Signed-off-by: Philipp Puschmann <pp@emlix.com>
    Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit df017210caa53da05045da92fa09e9d4c85f4d78
Author: Jay Vosburgh <jay.vosburgh@canonical.com>
Date:   Thu Mar 22 14:42:41 2018 +0000

    virtio-net: Fix operstate for virtio when no VIRTIO_NET_F_STATUS
    
    [ Upstream commit bda7fab54828bbef2164bb23c0f6b1a7d05cc718 ]
    
    The operstate update logic will leave an interface in the
    default UNKNOWN operstate if the interface carrier state never changes
    from the default carrier up state set at creation.  This includes the
    case of an explicit call to netif_carrier_on, as the carrier on to on
    transition has no effect on operstate.
    
            This affects virtio-net for the case that the virtio peer does
    not support VIRTIO_NET_F_STATUS (the feature that provides carrier state
    updates).  Without this feature, the virtio specification states that
    "the link should be assumed active," so, logically, the operstate should
    be UP instead of UNKNOWN.  This has impact on user space applications
    that use the operstate to make availability decisions for the interface.
    
            Resolve this by changing the virtio probe logic slightly to call
    netif_carrier_off for both the "with" and "without" VIRTIO_NET_F_STATUS
    cases, and then the existing call to netif_carrier_on for the "without"
    case will cause an operstate transition.
    
    Cc: "Michael S. Tsirkin" <mst@redhat.com>
    Cc: Jason Wang <jasowang@redhat.com>
    Cc: Ben Hutchings <ben@decadent.org.uk>
    Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
    Acked-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0d0504906abf5a4968a7f1d134f902f27b4cb57e
Author: Andreas Gruenbacher <agruenba@redhat.com>
Date:   Fri Mar 23 07:33:25 2018 -0700

    gfs2: Check for the end of metadata in punch_hole
    
    [ Upstream commit bb491ce67aa7c1635e5ae4f2f304a7d13d3dbe71 ]
    
    When punching a hole or truncating an inode down to a given size, also
    check if the truncate point / start of the hole is within the range we
    have metadata for.  Otherwise, we can end up freeing blocks that
    shouldn't be freed, corrupting the inode, or crashing the machine when
    trying to punch a hole into the void.
    
    When growing an inode via truncate, we set the new size but we don't
    allocate additional levels of indirect blocks and grow the inode height.
    When shrinking that inode again, the new size may still point beyond the
    end of the inode's metadata.
    
    Fixes xfstest generic/476.
    
    Debugged-by: Bob Peterson <rpeterso@redhat.com>
    Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
    Signed-off-by: Bob Peterson <rpeterso@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b054a540699042d503e6505163e45c4224c77e85
Author: Milton Miller <miltonm@us.ibm.com>
Date:   Thu Mar 15 11:02:06 2018 -0500

    watchdog: aspeed: Allow configuring for alternate boot
    
    [ Upstream commit 6ffa3402211acc30e47e691e14d62f3fd065a54e ]
    
    Allow the device tree to specify a watchdog to fallover to
    the alternate boot source.
    
    The aspeeed watchdog can set a latch directing flash chip select 0 to
    chip select 1, allowing boot from an alternate media if the watchdog
    is not reset in time.  On the ast2400 bank 1 also goes to flash bank 1,
    while on the ast2500 the chip selects are swapped.
    
    Also clear the secondary boot bit during the machine restart operation.
    Otherwise, the system will switch to the alternate boot after every
    reboot, which is not desired.
    
    Signed-off-by: Milton Miller <miltonm@us.ibm.com>
    Signed-off-by: Eddie James <eajames@linux.vnet.ibm.com>
    Reviewed-by: Joel Stanley <joel@jms.id.au>
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 05e868582d322b168c6033578ff41f7b79724dc2
Author: Petr Vorel <pvorel@suse.cz>
Date:   Fri Mar 23 14:41:08 2018 +0100

    ima: Fallback to the builtin hash algorithm
    
    [ Upstream commit ab60368ab6a452466885ef4edf0cefd089465132 ]
    
    IMA requires having it's hash algorithm be compiled-in due to it's
    early use.  The default IMA algorithm is protected by Kconfig to be
    compiled-in.
    
    The ima_hash kernel parameter allows to choose the hash algorithm. When
    the specified algorithm is not available or available as a module, IMA
    initialization fails, which leads to a kernel panic (mknodat syscall calls
    ima_post_path_mknod()).  Therefore as fallback we force IMA to use
    the default builtin Kconfig hash algorithm.
    
    Fixed crash:
    
    $ grep CONFIG_CRYPTO_MD4 .config
    CONFIG_CRYPTO_MD4=m
    
    [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.12.14-2.3-default root=UUID=74ae8202-9ca7-4e39-813b-22287ec52f7a video=1024x768-16 plymouth.ignore-serial-consoles console=ttyS0 console=tty resume=/dev/disk/by-path/pci-0000:00:07.0-part3 splash=silent showopts ima_hash=md4
    ...
    [    1.545190] ima: Can not allocate md4 (reason: -2)
    ...
    [    2.610120] BUG: unable to handle kernel NULL pointer dereference at           (null)
    [    2.611903] IP: ima_match_policy+0x23/0x390
    [    2.612967] PGD 0 P4D 0
    [    2.613080] Oops: 0000 [#1] SMP
    [    2.613080] Modules linked in: autofs4
    [    2.613080] Supported: Yes
    [    2.613080] CPU: 0 PID: 1 Comm: systemd Not tainted 4.12.14-2.3-default #1
    [    2.613080] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
    [    2.613080] task: ffff88003e2d0040 task.stack: ffffc90000190000
    [    2.613080] RIP: 0010:ima_match_policy+0x23/0x390
    [    2.613080] RSP: 0018:ffffc90000193e88 EFLAGS: 00010296
    [    2.613080] RAX: 0000000000000000 RBX: 000000000000000c RCX: 0000000000000004
    [    2.613080] RDX: 0000000000000010 RSI: 0000000000000001 RDI: ffff880037071728
    [    2.613080] RBP: 0000000000008000 R08: 0000000000000000 R09: 0000000000000000
    [    2.613080] R10: 0000000000000008 R11: 61c8864680b583eb R12: 00005580ff10086f
    [    2.613080] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000008000
    [    2.613080] FS:  00007f5c1da08940(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000
    [    2.613080] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [    2.613080] CR2: 0000000000000000 CR3: 0000000037002000 CR4: 00000000003406f0
    [    2.613080] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [    2.613080] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    [    2.613080] Call Trace:
    [    2.613080]  ? shmem_mknod+0xbf/0xd0
    [    2.613080]  ima_post_path_mknod+0x1c/0x40
    [    2.613080]  SyS_mknod+0x210/0x220
    [    2.613080]  entry_SYSCALL_64_fastpath+0x1a/0xa5
    [    2.613080] RIP: 0033:0x7f5c1bfde570
    [    2.613080] RSP: 002b:00007ffde1c90dc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000085
    [    2.613080] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5c1bfde570
    [    2.613080] RDX: 0000000000000000 RSI: 0000000000008000 RDI: 00005580ff10086f
    [    2.613080] RBP: 00007ffde1c91040 R08: 00005580ff10086f R09: 0000000000000000
    [    2.613080] R10: 0000000000104000 R11: 0000000000000246 R12: 00005580ffb99660
    [    2.613080] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000002
    [    2.613080] Code: 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 57 41 56 44 8d 14 09 41 55 41 54 55 53 44 89 d3 09 cb 48 83 ec 38 48 8b 05 c5 03 29 01 <4c> 8b 20 4c 39 e0 0f 84 d7 01 00 00 4c 89 44 24 08 89 54 24 20
    [    2.613080] RIP: ima_match_policy+0x23/0x390 RSP: ffffc90000193e88
    [    2.613080] CR2: 0000000000000000
    [    2.613080] ---[ end trace 9a9f0a8a73079f6a ]---
    [    2.673052] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
    [    2.673052]
    [    2.675337] Kernel Offset: disabled
    [    2.676405] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
    
    Signed-off-by: Petr Vorel <pvorel@suse.cz>
    Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cdfc0000a8d0d4b420a5de242f0e93411a53c5ff
Author: Jiandi An <anjiandi@codeaurora.org>
Date:   Tue Mar 6 23:26:26 2018 -0600

    ima: Fix Kconfig to select TPM 2.0 CRB interface
    
    [ Upstream commit fac37c628fd5d68fd7298d9b57ae8601ee1b4723 ]
    
    TPM_CRB driver provides TPM CRB 2.0 support.  If it is built as a
    module, the TPM chip is registered after IMA init.  tpm_pcr_read() in
    IMA fails and displays the following message even though eventually
    there is a TPM chip on the system.
    
    ima: No TPM chip found, activating TPM-bypass! (rc=-19)
    
    Fix IMA Kconfig to select TPM_CRB so TPM_CRB driver is built in the kernel
    and initializes before IMA.
    
    Signed-off-by: Jiandi An <anjiandi@codeaurora.org>
    Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d447adfb4204fb0b9493d16234f9b748dd53d82c
Author: Haiyang Zhang <haiyangz@microsoft.com>
Date:   Thu Mar 22 12:01:13 2018 -0700

    hv_netvsc: Fix the return status in RX path
    
    [ Upstream commit 5c71dadbb45970a8f0544a27ae8f1cbd9750e516 ]
    
    As defined in hyperv_net.h, the NVSP_STAT_SUCCESS is one not zero.
    Some functions returns 0 when it actually means NVSP_STAT_SUCCESS.
    This patch fixes them.
    
    In netvsc_receive(), it puts the last RNDIS packet's receive status
    for all packets in a vmxferpage which may contain multiple RNDIS
    packets.
    This patch puts NVSP_STAT_FAIL in the receive completion if one of
    the packets in a vmxferpage fails.
    
    Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b0c56b67431da969f05f53f03a11fe9330114b46
Author: Arjun Vynipadath <arjun@chelsio.com>
Date:   Fri Mar 23 15:25:10 2018 +0530

    cxgb4: Setup FW queues before registering netdev
    
    [ Upstream commit 843bd7db79c861b49e2912d723625f5fa8e94502 ]
    
    When NetworkManager is enabled, there are chances that interface up
    is called even before probe completes. This means we have not yet
    allocated the FW sge queues, hence rest of ingress queue allocation
    wont be proper. Fix this by calling setup_fw_sge_queues() before
    register_netdev().
    
    Fixes: 0fbc81b3ad51 ('chcr/cxgb4i/cxgbit/RDMA/cxgb4: Allocate resources dynamically for all cxgb4 ULD's')
    Signed-off-by: Arjun Vynipadath <arjun@chelsio.com>
    Signed-off-by: Casey Leedom <leedom@chelsio.com>
    Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 84a16f840f52ce2706136afebbf42ba48af76e29
Author: Anand Jain <anand.jain@oracle.com>
Date:   Sat Feb 24 19:43:56 2018 +0800

    btrfs: fix null pointer deref when target device is missing
    
    [ Upstream commit acf18c56fdcb952a06650282192e3b4ca1855c5e ]
    
    The replace target device can be missing when mounted with -o degraded,
    but we wont allocate a missing btrfs_device to it. So check the device
    before accessing.
    
    BUG: unable to handle kernel NULL pointer dereference at 00000000000000b0
    IP: btrfs_destroy_dev_replace_tgtdev+0x43/0xf0 [btrfs]
    Call Trace:
    btrfs_dev_replace_cancel+0x15f/0x180 [btrfs]
    btrfs_ioctl+0x2216/0x2590 [btrfs]
    do_vfs_ioctl+0x625/0x650
    SyS_ioctl+0x4e/0x80
    do_syscall_64+0x5d/0x160
    entry_SYSCALL64_slow_path+0x25/0x25
    
    This patch has been moved in front of patch "btrfs: log, when replace,
    is canceled by the user" that could reproduce the crash if the system
    reboots inside btrfs_dev_replace_start before the
    btrfs_dev_replace_finishing call.
    
     $ mkfs /dev/sda
     $ mount /dev/sda mnt
     $ btrfs replace start /dev/sda /dev/sdb
     <insert reboot>
     $ mount po degraded /dev/sdb mnt
     <crash>
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    [ added reproducer description from mail ]
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f02c9030ea1372c8764ee3b4a756ef96f22e0c9b
Author: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Date:   Sat Mar 3 05:10:44 2018 +0100

    ath9k: fix crash in spectral scan
    
    [ Upstream commit 221b6ec69ed9c56b6cd9a124a387a9472f14284e ]
    
    Fixes crash seen on arm smp systems (gateworks ventana imx6):
    
    Unable to handle kernel NULL pointer dereference at virtual address 00000014
    pgd = 80004000
    [00000014] *pgd=00000000
    Internal error: Oops - BUG: 17 [#1] PREEMPT SMP ARM
    Modules linked in: ip6table_filter nf_conntrack_ipv6 ip6_tables nf_log_ipv6 nf_defrag_ipv6 shortcut_fe ipcomp6 xfrm_ipcomp xfrm6_tunnel xfrm6_mode_tunnel xfrm6_mode_transport xfrm6_mode_ro xfrm6_mode_beet ip6_tunnel tunnel6 mip6 ah6 esp6 xfrm_algo sit ip_tunnel tunnel4 ipv6 ath10k_pci ath10k_core ath9k ath mac80211 cfg80211 compat ath_pci ath_hal(P) caamalg authencesn authenc caamrng caamhash caam_jr caam cdc_ncm usbnet usbcore sky2 imx2_wdt
    CPU: 0 PID: 3 Comm: ksoftirqd/0 Tainted: P                4.9.85 #19
    Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
    task: bf064980 task.stack: bf07c000
    PC is at relay_buf_full+0xc/0x30
    LR is at _674+0x740/0xf10 [ath9k]
    pc : [<8018bce0>]    lr : [<7f1aa604>]    psr: 80000013
    sp : bf07dbf0  ip : bf07dc00  fp : bf07dbfc
    r10: 0000003f  r9 : bf130e00  r8 : 809044b0
    r7 : 00000000  r6 : be67a9f0  r5 : 00000000  r4 : 809043e4
    r3 : c0864c24  r2 : 00000000  r1 : 00000004  r0 : 00000000
    Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
    Control: 10c5387d  Table: 4e6a004a  DAC: 00000055
    Process ksoftirqd/0 (pid: 3, stack limit = 0xbf07c210)
    Stack: (0xbf07dbf0 to 0xbf07e000)
    dbe0:                                     bf07dd04 bf07dc00 7f1aa604 8018bce0
    dc00: 00004014 be59e010 bf07dc34 bf07dc18 7f1a7084 7f19c07c be59c010 be6470a0
    dc20: 0000096c be648954 bf07dc6c bf07dc38 7f1c286c bf07dd90 bf07dc5c bf07dc48
    dc40: 8029ea4c 0000003c 00000001 be59c010 00000094 00000000 00000000 00000000
    dc60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    dc80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    dca0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    dcc0: 00000000 00000000 00000000 00000000 00000000 00000000 8010ef24 00000030
    dce0: be94f5e8 be6485a0 bddf0200 be59c010 be6465a0 be6415a0 bf07ddf4 bf07dd08
    dd00: 7f1cf800 7f1aa55c 1fc38c4c 00000000 bf07dd58 cccccccd 66666667 be640bc0
    dd20: bf07dd54 be6415a0 1fc38c4c 00000000 00000000 be59c038 be67a9c0 be59e010
    dd40: be67a9f0 be647170 8090c904 be59c010 00000000 00000001 1fc38e84 00000000
    dd60: be640bc0 bddf0200 00000200 00000010 0000003f 00000002 20000013 be59c010
    dd80: 8092d940 bf7ca2c0 bf07ddb4 bf07dd98 1fc38c4c 2602003f 0100ff1b 80ff1b00
    dda0: 00808080 00000000 00000000 80808080 80808080 80808080 80808080 00008080
    ddc0: 00000000 00000000 7f1b62b8 00000002 be6470ec be6470f0 00000000 bf07de98
    dde0: 8092d940 be6415a0 bf07de94 bf07ddf8 7f1d1ed8 7f1cf1fc 00000000 00000000
    de00: bf7cc4c0 00000400 be6470f0 bf07de18 8015165c be59c010 8090453c 8090453c
    de20: bf07dec4 be6465a0 8014f614 80148884 0000619a 00000001 bf07c000 00000100
    de40: bf07de78 00000001 7f327850 00000002 afb50401 bf064980 bf07de9c bf07de68
    de60: bf064a00 803cc668 bf064a00 be6470b4 be6470b8 80844180 00000000 bf07de98
    de80: 8092d940 bf07c000 bf07dec4 bf07de98 80124d18 7f1d1c44 80124c94 00000000
    dea0: 00000006 80902098 80902080 40000006 00000100 bf07c000 bf07df24 bf07dec8
    dec0: 8012501c 80124ca0 bf7cc4c0 bf064980 be95e1c0 04208040 80902d00 000061c7
    dee0: 0000000a 80600b54 8092d940 808441f8 80902080 bf07dec8 bf03b200 bf07c000
    df00: bf03b200 8090fe54 00000000 00000000 00000000 00000000 bf07df34 bf07df28
    df20: 80125148 80124f28 bf07df5c bf07df38 8013deb4 8012511c 00000000 bf03b240
    df40: bf03b200 8013dc90 00000000 00000000 bf07dfac bf07df60 8013ad40 8013dc9c
    df60: 70448040 00000001 00000000 bf03b200 00000000 00030003 bf07df78 bf07df78
    df80: 00000000 00000000 bf07df88 bf07df88 bf03b240 8013ac48 00000000 00000000
    dfa0: 00000000 bf07dfb0 80107760 8013ac54 00000000 00000000 00000000 00000000
    dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 8c120004 1190ad04
    Backtrace:
    [<8018bcd4>] (relay_buf_full) from [<7f1aa604>] (_674+0x740/0xf10 [ath9k])
    [<7f1aa550>] (_674 [ath9k]) from [<7f1cf800>] (_582+0x14b4/0x3708 [ath9k])
     r10:be6415a0 r9:be6465a0 r8:be59c010 r7:bddf0200 r6:be6485a0 r5:be94f5e8
     r4:00000030
    [<7f1cf1f0>] (_582 [ath9k]) from [<7f1d1ed8>] (_735+0x2a0/0xec4 [ath9k])
     r10:be6415a0 r9:8092d940 r8:bf07de98 r7:00000000 r6:be6470f0 r5:be6470ec
     r4:00000002
    [<7f1d1c38>] (_735 [ath9k]) from [<80124d18>] (tasklet_action+0x84/0xf8)
     r10:bf07c000 r9:8092d940 r8:bf07de98 r7:00000000 r6:80844180 r5:be6470b8
     r4:be6470b4
    [<80124c94>] (tasklet_action) from [<8012501c>] (__do_softirq+0x100/0x1f4)
     r10:bf07c000 r9:00000100 r8:40000006 r7:80902080 r6:80902098 r5:00000006
     r4:00000000 r3:80124c94
    [<80124f1c>] (__do_softirq) from [<80125148>] (run_ksoftirqd+0x38/0x4c)
     r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:8090fe54 r5:bf03b200
     r4:bf07c000
    [<80125110>] (run_ksoftirqd) from [<8013deb4>] (smpboot_thread_fn+0x224/0x260)
    [<8013dc90>] (smpboot_thread_fn) from [<8013ad40>] (kthread+0xf8/0x100)
     r9:00000000 r8:00000000 r7:8013dc90 r6:bf03b200 r5:bf03b240 r4:00000000
    [<8013ac48>] (kthread) from [<80107760>] (ret_from_fork+0x14/0x34)
     r7:00000000 r6:00000000 r5:8013ac48 r4:bf03b240
    Code: e89da800 e1a0c00d e92dd800 e24cb004 (e5901014)
    ---[ end trace dddf11ac9111b272 ]---
    Kernel panic - not syncing: Fatal exception in interrupt
    CPU1: stopping
    CPU: 1 PID: 0 Comm: swapper/1 Tainted: P      D         4.9.85 #19
    Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
    Backtrace:
    [<8010a708>] (dump_backtrace) from [<8010a99c>] (show_stack+0x18/0x1c)
     r7:bf093f58 r6:20000193 r5:809168e8 r4:00000000
    [<8010a984>] (show_stack) from [<802a09c4>] (dump_stack+0x94/0xa8)
    [<802a0930>] (dump_stack) from [<8010d184>] (handle_IPI+0xe8/0x180)
     r7:bf093f58 r6:00000000 r5:00000001 r4:808478c4
    [<8010d09c>] (handle_IPI) from [<801013e8>] (gic_handle_irq+0x78/0x7c)
     r7:f4000100 r6:bf093f58 r5:f400010c r4:8090467c
    [<80101370>] (gic_handle_irq) from [<8010b378>] (__irq_svc+0x58/0x8c)
    Exception stack(0xbf093f58 to 0xbf093fa0)
    3f40:                                                       bf7d62a0 00000000
    3f60: 0010a5f4 80113460 bf092000 809043e4 00000002 80904434 bf092008 412fc09a
    3f80: 00000000 bf093fb4 bf093fb8 bf093fa8 8010804c 80108050 60000013 ffffffff
     r9:bf092000 r8:bf092008 r7:bf093f8c r6:ffffffff r5:60000013 r4:80108050
    [<80108014>] (arch_cpu_idle) from [<80553c2c>] (default_idle_call+0x30/0x34)
    [<80553bfc>] (default_idle_call) from [<80158394>] (cpu_startup_entry+0xc4/0xfc)
    [<801582d0>] (cpu_startup_entry) from [<8010ce40>] (secondary_start_kernel+0x168/0x174)
     r7:8092d2f8 r4:80913568
    [<8010ccd8>] (secondary_start_kernel) from [<10101488>] (0x10101488)
     r5:00000055 r4:4f07806a
    Rebooting in 10 seconds..
    Reboot failed -- System halted
    
    Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8f446a84d69ff03f70fd1d92da7754deb8a83a10
Author: Jarosław Janik <jaroslaw.janik@gmail.com>
Date:   Sun Mar 11 19:51:56 2018 +0100

    nvme-pci: disable APST for Samsung NVMe SSD 960 EVO + ASUS PRIME Z370-A
    
    [ Upstream commit 467c77d4cbefaaf65e2f44fe102d543a52fcae5b ]
    
    Yet another "incompatible" Samsung NVMe SSD 960 EVO and Asus motherboard
    combination. 960 EVO device disappears from PCIe bus within few minutes
    after boot-up when APST is in use and never gets back. Forcing
    NVME_QUIRK_NO_APST is the only way to make this drive work with this
    particular motherboard. NVME_QUIRK_NO_DEEPEST_PS doesn't work, upgrading
    motherboard's BIOS didn't help either.
    Since this is a desktop motherboard, the only drawback of not using APST
    is increased device temperature.
    
    Signed-off-by: Jarosław Janik <jaroslaw.janik@gmail.com>
    Signed-off-by: Keith Busch <keith.busch@intel.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 29a6951af78046c2da550b101bbfa97daf83838a
Author: James Smart <jsmart2021@gmail.com>
Date:   Wed Feb 28 14:49:10 2018 -0800

    nvme_fc: fix abort race on teardown with lld reject
    
    [ Upstream commit b12740d316fa89f3f6191b71f986cf3b9383d379 ]
    
    Another abort race: An io request is started, becomes active,
    and is attempted to be started with the lldd. At the same time
    the controller is stopped/torndown and an itterator is run to
    abort the ios. As the io is active, it is added to the outstanding
    aborted io count.  However on the original io request thread, the
    driver ends up rejecting the io due to the condition that induced
    the controller teardown. The driver reject path didn't check whether
    it was in the outstanding io count. This left the count outstanding
    stopping controller teardown.
    
    Correct by, in the driver reject case, setting the state to
    inactive and checking whether it was in the outstanding io count.
    
    Signed-off-by: James Smart <james.smart@broadcom.com>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Signed-off-by: Keith Busch <keith.busch@intel.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3e269edc3deb1e8f2d1a88e0e172d41a1dda3169
Author: Karthikeyan Periyasamy <periyasa@codeaurora.org>
Date:   Mon Mar 12 17:09:40 2018 +0530

    ath10k: Fix kernel panic while using worker (ath10k_sta_rc_update_wk)
    
    [ Upstream commit 8b2d93dd22615cb7f3046a5a2083a6f8bb8052ed ]
    
    When attempt to run worker (ath10k_sta_rc_update_wk) after the station object
    (ieee80211_sta) delete will trigger the kernel panic.
    
    This problem arise in AP + Mesh configuration, Where the current node AP VAP
    and neighbor node mesh VAP MAC address are same. When the current mesh node
    try to establish the mesh link with neighbor node, driver peer creation for
    the neighbor mesh node fails due to duplication MAC address. Already the AP
    VAP created with same MAC address.
    
    It is caused by the following scenario steps.
    
    Steps:
    1. In above condition, ath10k driver sta_state callback (ath10k_sta_state)
       fails to do the state change for a station from IEEE80211_STA_NOTEXIST
       to IEEE80211_STA_NONE due to peer creation fails. Sta_state callback is
       called from ieee80211_add_station() to handle the new station
       (neighbor mesh node) request from the wpa_supplicant.
    2. Concurrently ath10k receive the sta_rc_update callback notification from
       the mesh_neighbour_update() to handle the beacon frames of the above
       neighbor mesh node. since its atomic callback, ath10k driver queue the
       work (ath10k_sta_rc_update_wk) to handle rc update.
    3. Due to driver sta_state callback fails (step 1), mac80211 free the station
       object.
    4. When the worker (ath10k_sta_rc_update_wk) scheduled to run, it will access
       the station object which is already deleted. so it will trigger kernel
       panic.
    
    Added the peer exist check in sta_rc_update callback before queue the work.
    
    Kernel Panic log:
    
    Unable to handle kernel NULL pointer dereference at virtual address 00000000
    pgd = c0204000
    [00000000] *pgd=00000000
    Internal error: Oops: 17 [#1] PREEMPT SMP ARM
    CPU: 1 PID: 1833 Comm: kworker/u4:2 Not tainted 3.14.77 #1
    task: dcef0000 ti: d72b6000 task.ti: d72b6000
    PC is at pwq_activate_delayed_work+0x10/0x40
    LR is at pwq_activate_delayed_work+0xc/0x40
    pc : [<c023f988>]    lr : [<c023f984>]    psr: 40000193
    sp : d72b7f18  ip : 0000007a  fp : d72b6000
    r10: 00000000  r9 : dd404414  r8 : d8c31998
    r7 : d72b6038  r6 : 00000004  r5 : d4907ec8  r4 : dcee1300
    r3 : ffffffe0  r2 : 00000000  r1 : 00000001  r0 : 00000000
    Flags: nZcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
    Control: 10c5787d  Table: 595bc06a  DAC: 00000015
    ...
    Process kworker/u4:2 (pid: 1833, stack limit = 0xd72b6238)
    Stack: (0xd72b7f18 to 0xd72b8000)
    7f00:                                                       00000001 dcee1300
    7f20: 00000001 c02410dc d8c31980 dd404400 dd404400 c0242790 d8c31980 00000089
    7f40: 00000000 d93e1340 00000000 d8c31980 c0242568 00000000 00000000 00000000
    7f60: 00000000 c02474dc 00000000 00000000 000000f8 d8c31980 00000000 00000000
    7f80: d72b7f80 d72b7f80 00000000 00000000 d72b7f90 d72b7f90 d72b7fac d93e1340
    7fa0: c0247404 00000000 00000000 c0208d20 00000000 00000000 00000000 00000000
    7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
    [<c023f988>] (pwq_activate_delayed_work) from [<c02410dc>] (pwq_dec_nr_in_flight+0x58/0xc4)
    [<c02410dc>] (pwq_dec_nr_in_flight) from [<c0242790>] (worker_thread+0x228/0x360)
    [<c0242790>] (worker_thread) from [<c02474dc>] (kthread+0xd8/0xec)
    [<c02474dc>] (kthread) from [<c0208d20>] (ret_from_fork+0x14/0x34)
    Code: e92d4038 e1a05000 ebffffbc[69210.619376] SMP: failed to stop secondary CPUs
    Rebooting in 3 seconds..
    
    Signed-off-by: Karthikeyan Periyasamy <periyasa@codeaurora.org>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1a98fc830ad2a0a427f20dcca8c090696a8cd473
Author: Colin Ian King <colin.king@canonical.com>
Date:   Fri Mar 23 23:51:57 2018 +0000

    net: qualcomm: rmnet: check for null ep to avoid null pointer dereference
    
    [ Upstream commit 0c29ba1b43df1eb7d8beb03fc929d2dac4c15f7e ]
    
    The call to rmnet_get_endpoint can potentially return NULL so check
    for this to avoid any subsequent null pointer dereferences on a NULL
    ep.
    
    Detected by CoverityScan, CID#1465385 ("Dereference null return value")
    
    Fixes: 23790ef12082 ("net: qualcomm: rmnet: Allow to configure flags for existing devices")
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c19393398f573637401d68bec070c229a8cd469e
Author: Fuyun Liang <liangfuyun1@huawei.com>
Date:   Sat Mar 24 11:32:43 2018 +0800

    net: hns3: fix for returning wrong value problem in hns3_get_rss_key_size
    
    [ Upstream commit 3bd6d258b1d5f76744567855d1376358a94f127d ]
    
    The return type of hns3_get_rss_key_size is u32. But a negative value is
    returned. This patch fixes it by replacing the negative value with zero.
    
    Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com>
    Signed-off-by: Peng Li <lipeng321@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2ee4b4acbb5e53bbe78ea0c67bdbb5950c76f571
Author: Fuyun Liang <liangfuyun1@huawei.com>
Date:   Sat Mar 24 11:32:44 2018 +0800

    net: hns3: fix for returning wrong value problem in hns3_get_rss_indir_size
    
    [ Upstream commit da44a00f06df1f823ea449065e79581ee624de4b ]
    
    The return type of hns3_get_rss_indir_size is u32. But a negative value is
    returned. This patch fixes it by replacing the negative value with zero.
    
    Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com>
    Signed-off-by: Peng Li <lipeng321@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 03d2d8a4baf3ce44b616d2a361b9b752366b8676
Author: Fuyun Liang <liangfuyun1@huawei.com>
Date:   Sat Mar 24 11:32:45 2018 +0800

    net: hns3: fix for the wrong shift problem in hns3_set_txbd_baseinfo
    
    [ Upstream commit 3c8f5c0339515202e8662b6e3ae36a7b16610caf ]
    
    Third parameter of hnae_set_field is shift, But a mask is given. This
    patch fixes it by replacing HNS3_TXD_BDTYPE_M with HNS3_TXD_BDTYPE_S.
    
    Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com>
    Signed-off-by: Peng Li <lipeng321@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 54ce28564430ade1ad5fa83e9bd4b5f00d259428
Author: Alexey Khoroshilov <khoroshilov@ispras.ru>
Date:   Sat Mar 24 00:36:46 2018 +0300

    watchdog: davinci_wdt: fix error handling in davinci_wdt_probe()
    
    [ Upstream commit d66e53649c18377edc08d48901e658e4fd491d46 ]
    
    clk_disable_unprepare() was added to one error path,
    but there is another one. The patch makes sure clk is
    disabled at the both of them.
    
    Found by Linux Driver Verification project (linuxtesting.org).
    
    Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c9f29f63c47f0778126aae2ceb17e5c3e72bd67a
Author: Leon Romanovsky <leonro@mellanox.com>
Date:   Tue Jan 2 16:49:56 2018 +0200

    net/mlx5: Protect from command bit overflow
    
    [ Upstream commit 957f6ba8adc7be401a74ccff427e4cfd88d3bfcb ]
    
    The system with CONFIG_UBSAN enabled on produces the following error
    during driver initialization. The reason to it that max_reg_cmds can be
    larger enough to cause to "1 << max_reg_cmds" overflow the unsigned long.
    
    ================================================================================
    UBSAN: Undefined behaviour in drivers/net/ethernet/mellanox/mlx5/core/cmd.c:1805:42
    signed integer overflow:
    -2147483648 - 1 cannot be represented in type 'int'
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc2-00032-g06cda2358d9b-dirty #724
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-0-ge51488c-20140602_164612-nilsson.home.kraxel.org 04/01/2014
    Call Trace:
     dump_stack+0xe9/0x18f
     ? dma_virt_alloc+0x81/0x81
     ubsan_epilogue+0xe/0x4e
     handle_overflow+0x187/0x20c
     mlx5_cmd_init+0x73a/0x12b0
     mlx5_load_one+0x1c3d/0x1d30
     init_one+0xd02/0xf10
     pci_device_probe+0x26c/0x3b0
     driver_probe_device+0x622/0xb40
     __driver_attach+0x175/0x1b0
     bus_for_each_dev+0xef/0x190
     bus_add_driver+0x2db/0x490
     driver_register+0x16b/0x1e0
     __pci_register_driver+0x177/0x1b0
     init+0x6d/0x92
     do_one_initcall+0x15b/0x270
     kernel_init_freeable+0x2d8/0x3d0
     kernel_init+0x14/0x190
     ret_from_fork+0x24/0x30
    ================================================================================
    
    Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d929886bbdf2f342b631161f4845711e7e5cff45
Author: Jacob Keller <jacob.e.keller@intel.com>
Date:   Fri Mar 16 01:26:35 2018 -0700

    i40e: hold the RTNL lock while changing interrupt schemes
    
    [ Upstream commit f0ee70a042e267a517e943220e18ae62d3c1995a ]
    
    When we suspend and resume, we need to clear and re-enable the interrupt
    scheme. This was previously not done while holding the RTNL lock, which
    could be problematic, because we are actually destroying and re-creating
    queues.
    
    Hold the RTNL lock for the entire sequence of preparing for reset, and
    when resuming. This additionally protects the flags related to interrupt
    scheme under RTNL lock so that their modification is properly threaded.
    
    This is part of a larger effort to remove the need for cmpxchg64 in
    i40e_set_priv_flags().
    
    Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
    Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b2bfdcecfb2ca46106608fe8ea9a692ebacbced6
Author: Michael Ellerman <mpe@ellerman.id.au>
Date:   Fri Mar 23 20:44:27 2018 +1100

    selftests: Print the test we're running to /dev/kmsg
    
    [ Upstream commit 88893cf787d3062c631cc20b875068eb11756e03 ]
    
    Some tests cause the kernel to print things to the kernel log
    buffer (ie. printk), in particular oops and warnings etc. However when
    running all the tests in succession it's not always obvious which
    test(s) caused the kernel to print something.
    
    We can narrow it down by printing which test directory we're running
    in to /dev/kmsg, if it's writable.
    
    Example output:
    
      [  170.149149] kselftest: Running tests in powerpc
      [  305.300132] kworker/dying (71) used greatest stack depth: 7776 bytes
                     left
      [  808.915456] kselftest: Running tests in pstore
    
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c3966db1210dd769abc2c90bd2ad7f712e35e73f
Author: Frank Asseg <frank.asseg@objecthunter.net>
Date:   Mon Mar 12 19:57:06 2018 +0100

    tools/thermal: tmon: fix for segfault
    
    [ Upstream commit 6c59f64b7ecf2bccbe73931d7d573d66ed13b537 ]
    
    Fixes a segfault occurring when e.g. <TAB> is pressed multiple times in the
    ncurses tmon application. The segfault is caused by incrementing
    cur_thermal_record in the main function without checking if it's value reached
    NR_THERMAL_RECORD immediately. Since the boundary check only occurred in
    update_thermal_data a race condition existed, which lead to an attempted read
    beyond the last element of the trec array.
    
    The fix was implemented by moving the cur_thermal_record incrementation to the
    update_thermal_data function using a temporary variable on which the boundary
    condition is checked before updating cur_thread_record, so that the variable is
    never incremented beyond the trec array's boundary.
    
    It seems the segfault does not occur on every machine: On a HP EliteBook G4 the
    segfault happens, while it does not happen on a Thinkpad T540p.
    
    Signed-off-by: Frank Asseg <frank.asseg@objecthunter.net>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0a736733e6d1159a026b727c2cc1d9adfa847c7e
Author: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Date:   Tue Mar 20 19:10:41 2018 +0530

    rsi: fix kernel panic observed on 64bit machine
    
    [ Upstream commit 864db4d5085349fcfa1f260b5bcd2adde3d7f2ed ]
    
    Following kernel panic is observed on 64bit machine while loading
    the driver. It is fixed if we pass dynamically allocated memory to
    SDIO for DMA.
    
    BUG: unable to handle kernel paging request at ffffeb04000172e0
    IP: sg_miter_stop+0x56/0x70
    PGD 0 P4D 0
    Oops: 0000 [#1] SMP PTI
    Modules linked in: rsi_sdio(OE+) rsi_91x(OE) btrsi(OE) rfcomm bluetooth
    ecdh_generic mac80211 mmc_block fuse xt_CHECKSUM iptable_mangle
    drm_kms_helper mmc_core serio_raw drm firewire_ohci tg3
    CPU: 0 PID: 4003 Comm: insmod Tainted: G           OE    4.16.0-rc1+ #27
    Hardware name: Dell Inc. Latitude E5500                  /0DW634, BIOS
    A19 06/13/2013
    RIP: 0010:sg_miter_stop+0x56/0x70
    RSP: 0018:ffff88007d003e78 EFLAGS: 00010002
    RAX: 0000000000000003 RBX: 0000000000000004 RCX: 0000000000000000
    RDX: ffffeb04000172c0 RSI: ffff88002f58002c RDI: ffff88007d003e80
    RBP: 0000000000000004 R08: ffff88007d003e80 R09: 0000000000000008
    R10: 0000000000000003 R11: 0000000000000001 R12: 0000000000000004
    R13: ffff88002f580028 R14: 0000000000000000 R15: 0000000000000004
    FS:  00007f35c29db700(0000) GS:ffff88007d000000(0000)
    knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffffeb04000172e0 CR3: 000000007038e000 CR4: 00000000000406f0
    Call Trace:
    <IRQ>
    sg_copy_buffer+0xc6/0xf0
    sdhci_tasklet_finish+0x170/0x260 [sdhci]
    tasklet_action+0xf4/0x100
    __do_softirq+0xef/0x26e
    irq_exit+0xbe/0xd0
    do_IRQ+0x4a/0xc0
    common_interrupt+0xa2/0xa2
    </IRQ>
    
    Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c60211ee3980413d7c71b42542f210ee17a31b53
Author: Michael Ellerman <mpe@ellerman.id.au>
Date:   Wed Mar 21 17:10:24 2018 +0530

    powerpc/perf: Fix kernel address leak via sampling registers
    
    [ Upstream commit e1ebd0e5b9d0a10ba65e63a3514b6da8c6a5a819 ]
    
    Current code in power_pmu_disable() does not clear the sampling
    registers like Sampling Instruction Address Register (SIAR) and
    Sampling Data Address Register (SDAR) after disabling the PMU. Since
    these are userspace readable and could contain kernel addresses, add
    code to explicitly clear the content of these registers.
    
    Also add a "context synchronizing instruction" to enforce no further
    updates to these registers as suggested by Power ISA v3.0B. From
    section 9.4, on page 1108:
    
      "If an mtspr instruction is executed that changes the value of a
      Performance Monitor register other than SIAR, SDAR, and SIER, the
      change is not guaranteed to have taken effect until after a
      subsequent context synchronizing instruction has been executed (see
      Chapter 11. "Synchronization Requirements for Context Alterations"
      on page 1133)."
    
    Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
    [mpe: Massage change log and add ISA reference]
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 26d7435d5ccdf540f1db5e1d755f713d2a446663
Author: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Date:   Wed Mar 21 17:10:25 2018 +0530

    powerpc/perf: Prevent kernel address leak to userspace via BHRB buffer
    
    [ Upstream commit bb19af816025d495376bd76bf6fbcf4244f9a06d ]
    
    The current Branch History Rolling Buffer (BHRB) code does not check
    for any privilege levels before updating the data from BHRB. This
    could leak kernel addresses to userspace even when profiling only with
    userspace privileges. Add proper checks to prevent it.
    
    Acked-by: Balbir Singh <bsingharora@gmail.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c469853207b9a950f1c9f068c60e4275cd264342
Author: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Date:   Sat Mar 17 15:01:39 2018 +0100

    mt76x2: fix warning in ieee80211_get_key_rx_seq()
    
    [ Upstream commit c03a5aacde0c86f6dabab8f17a6d1911ee13b6c4 ]
    
    Fall back to software encryption for hw unsupported ciphers in order
    to fix the following warning in ieee80211_get_key_rx_seq routine:
    
    WARNING: CPU: 1 PID: 1277 at backports-2017-11-01/net/mac80211/key.c:
    1010 mt76_wcid_key_setup+0x6c/0x138 [mt76]
    CPU: 1 PID: 1277 Comm: hostapd Tainted: G        W       4.9.86 #0
    Stack : 00000000 00000000 80527b4a 00000042 80523824 00000000 00000000 80520000
            8fd79a9c 804bbda7 80454c84 00000001 000004fd 80523824 8f7e4ba0 8eceda12
            00000010 8006af94 00000001 80520000 804c1f04 804c1f08 80459890 8ec999b4
            00000003 800a7840 8f7e4ba0 8eceda12 8121de20 00000000 00000001 00c999b4
            00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
            ...
    Call Trace:
    [<8000f52c>] show_stack+0x70/0x8c
    [<801d8d04>] dump_stack+0x94/0xd0
    [<8002bcd4>] __warn+0x110/0x118
    [<8002bd70>] warn_slowpath_null+0x1c/0x2c
    [<8f0415cc>] mt76_wcid_key_setup+0x6c/0x138 [mt76]
    [<8f1311b4>] mt76x2_dma_cleanup+0xa38/0x1048 [mt76x2e]
    
    Fixes: 30ce7f4456ae ("mt76: validate rx CCMP PN")
    Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
    Acked-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8d9e662c7692739ea1756f7f7f39151e45b3e588
Author: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Date:   Sat Mar 17 12:29:27 2018 +0100

    mt76x2: fix possible NULL pointer dereferencing in mt76x2_tx()
    
    [ Upstream commit 6958b027435aa54d82bbef09a007fd287f439977 ]
    
    Fix a theoretical NULL pointer dereferencing in mt76x2_tx routine that
    can occurs for injected frames in a monitor vif since vif pointer could
    be NULL for that interfaces
    
    Fixes: 23405236460b ("mt76: fix transmission of encrypted mgmt frames")
    Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
    Acked-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 073856580b405637a6a5c755068c1a569e1f950f
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Mon Mar 26 19:50:31 2018 -0700

    hwmon: (nct6775) Fix writing pwmX_mode
    
    [ Upstream commit 415eb2a1aaa4881cf85bd86c683356fdd8094a23 ]
    
    pwmX_mode is defined in the ABI as 0=DC mode, 1=pwm mode. The chip
    register bit is set to 1 for DC mode. This got mixed up, and writing
    1 into pwmX_mode resulted in DC mode enabled. Fix it up by using
    the ABI definition throughout the driver for consistency.
    
    Fixes: 77eb5b3703d99 ("hwmon: (nct6775) Add support for pwm, pwm_mode, ... ")
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e8532355b2cf5e545afb43d6d5a77fb7ba191819
Author: Kan Liang <kan.liang@linux.intel.com>
Date:   Mon Mar 26 09:42:09 2018 -0400

    perf mmap: Fix accessing unmapped mmap in perf_mmap__read_done()
    
    [ Upstream commit f58385f629c87a9e210108b39c1f4950d0363ad2 ]
    
    There is a segmentation fault when running 'perf trace'. For example:
    
      [root@jouet e]# perf trace -e *chdir -o /tmp/bla perf report --ignore-vmlinux -i ../perf.data
    
    The perf_mmap__consume() could unmap the mmap. It needs to check the
    refcnt in perf_mmap__read_done().
    
    Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Fixes: ee023de05f35 ("perf mmap: Introduce perf_mmap__read_done()")
    Link: http://lkml.kernel.org/r/1522071729-16776-1-git-send-email-kan.liang@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9d434e579b3c5402cbc0f80c3f669f1d002a0722
Author: Helge Deller <deller@gmx.de>
Date:   Sun Mar 25 14:04:22 2018 +0200

    parisc/pci: Switch LBA PCI bus from Hard Fail to Soft Fail mode
    
    [ Upstream commit b845f66f78bf42a4ce98e5cfe0e94fab41dd0742 ]
    
    Carlo Pisani noticed that his C3600 workstation behaved unstable during heavy
    I/O on the PCI bus with a VIA VT6421 IDE/SATA PCI card.
    
    To avoid such instability, this patch switches the LBA PCI bus from Hard Fail
    mode into Soft Fail mode. In this mode the bus will return -1UL for timed out
    MMIO transactions, which is exactly how the x86 (and most other architectures)
    PCI busses behave.
    
    This patch is based on a proposal by Grant Grundler and Kyle McMartin 10
    years ago:
    https://www.spinics.net/lists/linux-parisc/msg01027.html
    
    Cc: Carlo Pisani <carlojpisani@gmail.com>
    Cc: Kyle McMartin <kyle@mcmartin.ca>
    Reviewed-by: Grant Grundler <grantgrundler@gmail.com>
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3f5df7086e3c4e53da40768665ce11c0f95d076c
Author: Eran Ben Elisha <eranbe@mellanox.com>
Date:   Tue Jan 16 17:25:06 2018 +0200

    net/mlx5e: Move all TX timeout logic to be under state lock
    
    [ Upstream commit bfc647d52e67dc756c605e9a50d45b71054c2533 ]
    
    Driver callback for handling TX timeout should access some internal
    resources (SQ, CQ) in order to decide if the tx timeout work should be
    scheduled.  These resources might be unavailable if channels are closed
    in parallel (ifdown for example).
    
    The state lock is the mechanism to protect from such races.
    Move all TX timeout logic to be in the work under a state lock.
    
    In addition, Move the work from the global WQ to mlx5e WQ to make sure
    this work is flushed when device is detached..
    
    Also, move the mlx5e_tx_timeout_work code to be next to the TX timeout
    NDO for better code locality.
    
    Fixes: 3947ca185999 ("net/mlx5e: Implement ndo_tx_timeout callback")
    Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2443823b113f85c5ae6f2897d139fad5a0f7d278
Author: Sara Sharon <sara.sharon@intel.com>
Date:   Tue Dec 19 09:19:32 2017 +0200

    iwlwifi: mvm: take RCU lock before dereferencing
    
    [ Upstream commit f4f155e5ec04d381b2f0870817d93dbdc259aa63 ]
    
    RCU isn't properly locked.
    
    Fixes: 46d372af9935 ("iwlwifi: mvm: rs: new rate scale API - add FW notifications")
    Signed-off-by: Sara Sharon <sara.sharon@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e2ba7cef34d8518c8018a4794dc6aa45bec0dd98
Author: Luca Coelho <luciano.coelho@intel.com>
Date:   Mon Dec 18 20:13:07 2017 +0200

    iwlwifi: mvm: check if mac80211_queue is valid in iwl_mvm_disable_txq
    
    [ Upstream commit 9a233bb8025105db9a60b5d761005cc5a6c77f3d ]
    
    Sometimes iwl_mvm_disable_txq() may be called with mac80211_queue ==
    IEEE80211_INVAL_HW_QUEUE, and this would cause us to use BIT(0xFF)
    which is way too large for the u16 we used to store it in
    hw_queue_to_mac820211.  If this happens the following UBSAN warning
    will be generated:
    
    [  167.185167] UBSAN: Undefined behaviour in drivers/net/wireless/intel/iwlwifi/mvm/utils.c:838:5
    [  167.185171] shift exponent 255 is too large for 64-bit type 'long unsigned int'
    
    Fix that by checking that it is not IEEE80211_INVAL_HW_QUEUE and,
    while at it, add a warning if the queue number is larger than
    IEEE80211_MAX_QUEUES.
    
    Fixes: 34e10860ae8d ("iwlwifi: mvm: remove references to queue_info in new TX path")
    Reported-by: Paul Menzel <pmenzel+linux-wireless@molgen.mpg.de>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dc20f19d8d3abadc7f0e1f01bce275725baec8fb
Author: Greg Ungerer <gerg@linux-m68k.org>
Date:   Wed Mar 28 17:12:18 2018 +1000

    m68k: set dma and coherent masks for platform FEC ethernets
    
    [ Upstream commit f61e64310b75733d782e930d1fb404b84699eed6 ]
    
    As of commit 205e1b7f51e4 ("dma-mapping: warn when there is no
    coherent_dma_mask") the Freescale FEC driver is issuing the following
    warning on driver initialization on ColdFire systems:
    
    WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516 0x40159e20
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper Not tainted 4.16.0-rc7-dirty #4
    Stack from 41833dd8:
            41833dd8 40259c53 40025534 40279e26 00000003 00000000 4004e514 41827000
            400255de 40244e42 00000204 40159e20 00000009 00000000 00000000 4024531d
            40159e20 40244e42 00000204 00000000 00000000 00000000 00000007 00000000
            00000000 40279e26 4028d040 40226576 4003ae88 40279e26 418273f6 41833ef8
            7fffffff 418273f2 41867028 4003c9a2 4180ac6c 00000004 41833f8c 4013e71c
            40279e1c 40279e26 40226c16 4013ced2 40279e26 40279e58 4028d040 00000000
    Call Trace:
            [<40025534>] 0x40025534
     [<4004e514>] 0x4004e514
     [<400255de>] 0x400255de
     [<40159e20>] 0x40159e20
     [<40159e20>] 0x40159e20
    
    It is not fatal, the driver and the system continue to function normally.
    
    As per the warning the coherent_dma_mask is not set on this device.
    There is nothing special about the DMA memory coherency on this hardware
    so we can just set the mask to 32bits in the platform data for the FEC
    ethernet devices.
    
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2824e12f7e115008a74f677553522c48caf16683
Author: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Date:   Thu Mar 1 10:15:32 2018 +0200

    intel_th: Use correct method of finding hub
    
    [ Upstream commit 9ad577087165478c9d9be82b15ed9bf2db5835f5 ]
    
    Since commit 8edc514b01e9 ("intel_th: Make SOURCE devices children of the
    root device") the hub is not the parent of SOURCE devices any more, so the
    new helper function should be used for that instead of always using the
    parent. The intel_th_set_output() path, however, still uses the old
    logic, leading to the hub driver structure being aliased with something
    else, like struct pci_driver or struct acpi_driver, and an incorrect call
    to an address inferred from that, potentially resulting in a crash.
    
    Fixes: 8edc514b01e9 ("intel_th: Make SOURCE devices children of the root device")
    Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f941ccc0a0dc93bbaeaa01e8f467a3f6f86e6448
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date:   Thu Mar 22 16:22:33 2018 +0100

    iommu/amd: Take into account that alloc_dev_data() may return NULL
    
    [ Upstream commit 39ffe39545cd5cb5b8cee9f0469165cf24dc62c2 ]
    
    find_dev_data() does not check whether the return value alloc_dev_data()
    is NULL. This was okay once because the pointer was returned once as-is.
    Since commit df3f7a6e8e85 ("iommu/amd: Use is_attach_deferred
    call-back") the pointer may be used within find_dev_data() so a NULL
    check is required.
    
    Cc: Baoquan He <bhe@redhat.com>
    Fixes: df3f7a6e8e85 ("iommu/amd: Use is_attach_deferred call-back")
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c857ad82766a97ddd68ac8df4f79c13f31372f72
Author: Anilkumar Kolli <akolli@codeaurora.org>
Date:   Wed Mar 28 12:19:40 2018 +0300

    ath10k: advertize beacon_int_min_gcd
    
    [ Upstream commit 8ebee73b574ad3dd1f14d461f65ceaffbd637650 ]
    
    This patch fixes regression caused by 0c317a02ca98
    ("cfg80211: support virtual interfaces with different beacon intervals"),
    with this change cfg80211 expects the driver to advertize
    'beacon_int_min_gcd' to support different beacon intervals in multivap
    scenario. This support is added for, QCA988X/QCA99X0/QCA9984/QCA4019.
    
    Verifed AP + mesh bring up on QCA9984 with beacon interval 100msec and
    1000msec respectively.
    Frimware: firmware-5.bin_10.4-3.5.3-00053
    
    Fixes: 0c317a02ca98 ("cfg80211: support virtual interfaces with different beacon intervals")
    Signed-off-by: Anilkumar Kolli <akolli@codeaurora.org>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 014c61087d1ae8b4b6366fc36601eba4c78bef39
Author: Harry Morris <h.morris@cascoda.com>
Date:   Wed Mar 28 11:54:27 2018 +0100

    ieee802154: ca8210: fix uninitialised data read
    
    [ Upstream commit 86674a97f5055f4c7f406563408096e8cf9364ff ]
    
    In ca8210_test_int_user_write() a user can request the transfer of a
    frame with a length field (command.length) that is longer than the
    actual buffer provided (len). In this scenario the driver will copy
    the buffer contents into the uninitialised command[] buffer, then
    transfer <data.length> bytes over the SPI even though only <len> bytes
    had been populated, potentially leaking sensitive kernel memory.
    
    Also the first 6 bytes of the command buffer must be initialised in case
    a malformed, short packet is written and the uninitialised bytes are
    read in ca8210_test_check_upstream.
    
    Reported-by: Domen Puncer Kugler <domen.puncer@samsung.com>
    Signed-off-by: Harry Morris <h.morris@cascoda.com>
    Tested-by: Harry Morris <h.morris@cascoda.com>
    Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1c4bf6333dd3ffc9f2af208f1c00a783202cf4a4
Author: Michael Ellerman <mpe@ellerman.id.au>
Date:   Fri Mar 30 23:27:25 2018 +1100

    powerpc/mpic: Check if cpu_possible() in mpic_physmask()
    
    [ Upstream commit 0834d627fbea00c1444075eb3e448e1974da452d ]
    
    In mpic_physmask() we loop over all CPUs up to 32, then get the hard
    SMP processor id of that CPU.
    
    Currently that's possibly walking off the end of the paca array, but
    in a future patch we will change the paca array to be an array of
    pointers, and in that case we will get a NULL for missing CPUs and
    oops. eg:
    
      Unable to handle kernel paging request for data at address 0x88888888888888b8
      Faulting instruction address: 0xc00000000004e380
      Oops: Kernel access of bad area, sig: 11 [#1]
      ...
      NIP .mpic_set_affinity+0x60/0x1a0
      LR  .irq_do_set_affinity+0x48/0x100
    
    Fix it by checking the CPU is possible, this also fixes the code if
    there are gaps in the CPU numbering which probably never happens on
    mpic systems but who knows.
    
    Debugged-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2eacd4f5882842d8ad4ca0f486d0c2f573715a72
Author: Lenny Szubowicz <lszubowi@redhat.com>
Date:   Tue Mar 27 09:56:40 2018 -0400

    ACPI: acpi_pad: Fix memory leak in power saving threads
    
    [ Upstream commit 8b29d29abc484d638213dd79a18a95ae7e5bb402 ]
    
    Fix once per second (round_robin_time) memory leak of about 1 KB in
    each acpi_pad kernel idling thread that is activated.
    
    Found by testing with kmemleak.
    
    Signed-off-by: Lenny Szubowicz <lszubowi@redhat.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 918e61cc755d5d60560f703e232fbcf20c26eb65
Author: Aaro Koskinen <aaro.koskinen@iki.fi>
Date:   Fri Mar 16 22:17:28 2018 +0200

    drivers: macintosh: rack-meter: really fix bogus memsets
    
    [ Upstream commit e283655b5abe26462d53d5196f186c5e8863af3b ]
    
    We should zero an array using sizeof instead of number of elements.
    
    Fixes the following compiler (GCC 7.3.0) warnings:
    
    drivers/macintosh/rack-meter.c: In function 'rackmeter_do_pause':
    drivers/macintosh/rack-meter.c:157:2: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
    drivers/macintosh/rack-meter.c:158:2: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
    
    Fixes: 4f7bef7a9f69 ("drivers: macintosh: rack-meter: fix bogus memsets")
    Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a69ede709fda860b7ab1b7a7ce440d4aa59059d9
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Thu Mar 29 12:01:53 2018 +0300

    xen/acpi: off by one in read_acpi_id()
    
    [ Upstream commit c37a3c94775855567b90f91775b9691e10bd2806 ]
    
    If acpi_id is == nr_acpi_bits, then we access one element beyond the end
    of the acpi_psd[] array or we set one bit beyond the end of the bit map
    when we do __set_bit(acpi_id, acpi_id_present);
    
    Fixes: 59a568029181 ("xen/acpi-processor: C and P-state driver that uploads said data to hypervisor.")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6c45c185946f31fafd1b08a82b713b32a9097839
Author: David Howells <dhowells@redhat.com>
Date:   Fri Mar 30 21:04:44 2018 +0100

    rxrpc: Don't treat call aborts as conn aborts
    
    [ Upstream commit 57b0c9d49b94bbeb53649b7fbd264603c1ebd585 ]
    
    If a call-level abort is received for the previous call to complete on a
    connection channel, then that abort is queued for the connection processor
    to handle.  Unfortunately, the connection processor then assumes without
    checking that the abort is connection-level (ie. callNumber is 0) and
    distributes it over all active calls on that connection, thereby
    incorrectly aborting them.
    
    Fix this by discarding aborts aimed at a completed call.
    
    Further, discard all packets aimed at a call that's complete if there's
    currently an active call on a channel, since the DATA packets associated
    with the new call automatically terminate the old call.
    
    Fixes: 18bfeba50dfd ("rxrpc: Perform terminal call ACK/ABORT retransmission from conn processor")
    Reported-by: Marc Dionne <marc.dionne@auristor.com>
    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit db2dfb3fec91a7eda646de037bafb0b15fe4f8ca
Author: David Howells <dhowells@redhat.com>
Date:   Fri Mar 30 21:04:43 2018 +0100

    rxrpc: Fix Tx ring annotation after initial Tx failure
    
    [ Upstream commit 03877bf6a30cca7d4bc3ffabd3c3e9464a7a1a19 ]
    
    rxrpc calls have a ring of packets that are awaiting ACK or retransmission
    and a parallel ring of annotations that tracks the state of those packets.
    If the initial transmission of a packet on the underlying UDP socket fails
    then the packet annotation is marked for resend - but the setting of this
    mark accidentally erases the last-packet mark also stored in the same
    annotation slot.  If this happens, a call won't switch out of the Tx phase
    when all the packets have been transmitted.
    
    Fix this by retaining the last-packet mark and only altering the packet
    state.
    
    Fixes: 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code")
    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ff11395bcf03ddf8fd8a09ff063a6a6fd3052740
Author: Marc Dionne <marc.dionne@auristor.com>
Date:   Fri Mar 30 21:04:44 2018 +0100

    rxrpc: Fix resend event time calculation
    
    [ Upstream commit 59299aa1028fce051adbd25aaff7c387b865cd6d ]
    
    Commit a158bdd3 ("rxrpc: Fix call timeouts") reworked the time calculation
    for the next resend event.  For this calculation, "oldest" will be before
    "now", so ktime_sub(oldest, now) will yield a negative value.  When passed
    to nsecs_to_jiffies which expects an unsigned value, the end result will be
    a very large value, and a resend event scheduled far into the future.  This
    could cause calls to stall if some packets were lost.
    
    Fix by ordering the arguments to ktime_sub correctly.
    
    Fixes: a158bdd3247b ("rxrpc: Fix call timeouts")
    Signed-off-by: Marc Dionne <marc.dionne@auristor.com>
    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1f586802bb18892d2a6eb7d31d7fed78946d21a1
Author: Qu Wenruo <wqu@suse.com>
Date:   Tue Dec 19 15:44:54 2017 +0800

    btrfs: qgroup: Fix root item corruption when multiple same source snapshots are created with quota enabled
    
    [ Upstream commit 4d31778aa2fa342f5f92ca4025b293a1729161d1 ]
    
    When multiple pending snapshots referring to the same source subvolume
    are executed, enabled quota will cause root item corruption, where root
    items are using old bytenr (no backref in extent tree).
    
    This can be triggered by fstests btrfs/152.
    
    The cause is when source subvolume is still dirty, extra commit
    (simplied transaction commit) of qgroup_account_snapshot() can skip
    dirty roots not recorded in current transaction, making root item of
    source subvolume not updated.
    
    Fix it by forcing recording source subvolume in current transaction
    before qgroup sub-transaction commit.
    
    Reported-by: Justin Maggard <jmaggard@netgear.com>
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    Reviewed-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cbb1d7adea3ef09b2c2b9e8b01d76c1395165896
Author: Jeff Mahoney <jeffm@suse.com>
Date:   Fri Mar 16 14:36:27 2018 -0400

    btrfs: fix lockdep splat in btrfs_alloc_subvolume_writers
    
    [ Upstream commit 8a5a916d9a35e13576d79cc16e24611821b13e34 ]
    
    While running btrfs/011, I hit the following lockdep splat.
    
    This is the important bit:
       pcpu_alloc+0x1ac/0x5e0
       __percpu_counter_init+0x4e/0xb0
       btrfs_init_fs_root+0x99/0x1c0 [btrfs]
       btrfs_get_fs_root.part.54+0x5b/0x150 [btrfs]
       resolve_indirect_refs+0x130/0x830 [btrfs]
       find_parent_nodes+0x69e/0xff0 [btrfs]
       btrfs_find_all_roots_safe+0xa0/0x110 [btrfs]
       btrfs_find_all_roots+0x50/0x70 [btrfs]
       btrfs_qgroup_prepare_account_extents+0x53/0x90 [btrfs]
       btrfs_commit_transaction+0x3ce/0x9b0 [btrfs]
    
    The percpu_counter_init call in btrfs_alloc_subvolume_writers
    uses GFP_KERNEL, which we can't do during transaction commit.
    
    This switches it to GFP_NOFS.
    
    ========================================================
    WARNING: possible irq lock inversion dependency detected
    4.12.14-kvmsmall #8 Tainted: G        W
    --------------------------------------------------------
    kswapd0/50 just changed the state of lock:
     (&delayed_node->mutex){+.+.-.}, at: [<ffffffffc06994fa>] __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
    but this lock took another, RECLAIM_FS-unsafe lock in the past:
     (pcpu_alloc_mutex){+.+.+.}
    
    and interrupts could create inverse lock ordering between them.
    
    other info that might help us debug this:
    Chain exists of:
      &delayed_node->mutex --> &found->groups_sem --> pcpu_alloc_mutex
    
     Possible interrupt unsafe locking scenario:
    
           CPU0                    CPU1
           ----                    ----
      lock(pcpu_alloc_mutex);
                                   local_irq_disable();
                                   lock(&delayed_node->mutex);
                                   lock(&found->groups_sem);
      <Interrupt>
        lock(&delayed_node->mutex);
    
     *** DEADLOCK ***
    
    2 locks held by kswapd0/50:
     #0:  (shrinker_rwsem){++++..}, at: [<ffffffff811dc11f>] shrink_slab+0x7f/0x5b0
     #1:  (&type->s_umount_key#30){+++++.}, at: [<ffffffff8126dec6>] trylock_super+0x16/0x50
    
    the shortest dependencies between 2nd lock and 1st lock:
       -> (pcpu_alloc_mutex){+.+.+.} ops: 4904 {
          HARDIRQ-ON-W at:
                              __mutex_lock+0x4e/0x8c0
                              pcpu_alloc+0x1ac/0x5e0
                              alloc_kmem_cache_cpus.isra.70+0x25/0xa0
                              __do_tune_cpucache+0x2c/0x220
                              do_tune_cpucache+0x26/0xc0
                              enable_cpucache+0x6d/0xf0
                              kmem_cache_init_late+0x42/0x75
                              start_kernel+0x343/0x4cb
                              x86_64_start_kernel+0x127/0x134
                              secondary_startup_64+0xa5/0xb0
          SOFTIRQ-ON-W at:
                              __mutex_lock+0x4e/0x8c0
                              pcpu_alloc+0x1ac/0x5e0
                              alloc_kmem_cache_cpus.isra.70+0x25/0xa0
                              __do_tune_cpucache+0x2c/0x220
                              do_tune_cpucache+0x26/0xc0
                              enable_cpucache+0x6d/0xf0
                              kmem_cache_init_late+0x42/0x75
                              start_kernel+0x343/0x4cb
                              x86_64_start_kernel+0x127/0x134
                              secondary_startup_64+0xa5/0xb0
          RECLAIM_FS-ON-W at:
                                 __kmalloc+0x47/0x310
                                 pcpu_extend_area_map+0x2b/0xc0
                                 pcpu_alloc+0x3ec/0x5e0
                                 alloc_kmem_cache_cpus.isra.70+0x25/0xa0
                                 __do_tune_cpucache+0x2c/0x220
                                 do_tune_cpucache+0x26/0xc0
                                 enable_cpucache+0x6d/0xf0
                                 __kmem_cache_create+0x1bf/0x390
                                 create_cache+0xba/0x1b0
                                 kmem_cache_create+0x1f8/0x2b0
                                 ksm_init+0x6f/0x19d
                                 do_one_initcall+0x50/0x1b0
                                 kernel_init_freeable+0x201/0x289
                                 kernel_init+0xa/0x100
                                 ret_from_fork+0x3a/0x50
          INITIAL USE at:
                             __mutex_lock+0x4e/0x8c0
                             pcpu_alloc+0x1ac/0x5e0
                             alloc_kmem_cache_cpus.isra.70+0x25/0xa0
                             setup_cpu_cache+0x2f/0x1f0
                             __kmem_cache_create+0x1bf/0x390
                             create_boot_cache+0x8b/0xb1
                             kmem_cache_init+0xa1/0x19e
                             start_kernel+0x270/0x4cb
                             x86_64_start_kernel+0x127/0x134
                             secondary_startup_64+0xa5/0xb0
        }
        ... key      at: [<ffffffff821d8e70>] pcpu_alloc_mutex+0x70/0xa0
        ... acquired at:
       pcpu_alloc+0x1ac/0x5e0
       __percpu_counter_init+0x4e/0xb0
       btrfs_init_fs_root+0x99/0x1c0 [btrfs]
       btrfs_get_fs_root.part.54+0x5b/0x150 [btrfs]
       resolve_indirect_refs+0x130/0x830 [btrfs]
       find_parent_nodes+0x69e/0xff0 [btrfs]
       btrfs_find_all_roots_safe+0xa0/0x110 [btrfs]
       btrfs_find_all_roots+0x50/0x70 [btrfs]
       btrfs_qgroup_prepare_account_extents+0x53/0x90 [btrfs]
       btrfs_commit_transaction+0x3ce/0x9b0 [btrfs]
       transaction_kthread+0x176/0x1b0 [btrfs]
       kthread+0x102/0x140
       ret_from_fork+0x3a/0x50
    
      -> (&fs_info->commit_root_sem){++++..} ops: 1566382 {
         HARDIRQ-ON-W at:
                            down_write+0x3e/0xa0
                            cache_block_group+0x287/0x420 [btrfs]
                            find_free_extent+0x106c/0x12d0 [btrfs]
                            btrfs_reserve_extent+0xd8/0x170 [btrfs]
                            cow_file_range.isra.66+0x133/0x470 [btrfs]
                            run_delalloc_range+0x121/0x410 [btrfs]
                            writepage_delalloc.isra.50+0xfe/0x180 [btrfs]
                            __extent_writepage+0x19a/0x360 [btrfs]
                            extent_write_cache_pages.constprop.56+0x249/0x3e0 [btrfs]
                            extent_writepages+0x4d/0x60 [btrfs]
                            do_writepages+0x1a/0x70
                            __filemap_fdatawrite_range+0xa7/0xe0
                            btrfs_rename+0x5ee/0xdb0 [btrfs]
                            vfs_rename+0x52a/0x7e0
                            SyS_rename+0x351/0x3b0
                            do_syscall_64+0x79/0x1e0
                            entry_SYSCALL_64_after_hwframe+0x42/0xb7
         HARDIRQ-ON-R at:
                            down_read+0x35/0x90
                            caching_thread+0x57/0x560 [btrfs]
                            normal_work_helper+0x1c0/0x5e0 [btrfs]
                            process_one_work+0x1e0/0x5c0
                            worker_thread+0x44/0x390
                            kthread+0x102/0x140
                            ret_from_fork+0x3a/0x50
         SOFTIRQ-ON-W at:
                            down_write+0x3e/0xa0
                            cache_block_group+0x287/0x420 [btrfs]
                            find_free_extent+0x106c/0x12d0 [btrfs]
                            btrfs_reserve_extent+0xd8/0x170 [btrfs]
                            cow_file_range.isra.66+0x133/0x470 [btrfs]
                            run_delalloc_range+0x121/0x410 [btrfs]
                            writepage_delalloc.isra.50+0xfe/0x180 [btrfs]
                            __extent_writepage+0x19a/0x360 [btrfs]
                            extent_write_cache_pages.constprop.56+0x249/0x3e0 [btrfs]
                            extent_writepages+0x4d/0x60 [btrfs]
                            do_writepages+0x1a/0x70
                            __filemap_fdatawrite_range+0xa7/0xe0
                            btrfs_rename+0x5ee/0xdb0 [btrfs]
                            vfs_rename+0x52a/0x7e0
                            SyS_rename+0x351/0x3b0
                            do_syscall_64+0x79/0x1e0
                            entry_SYSCALL_64_after_hwframe+0x42/0xb7
         SOFTIRQ-ON-R at:
                            down_read+0x35/0x90
                            caching_thread+0x57/0x560 [btrfs]
                            normal_work_helper+0x1c0/0x5e0 [btrfs]
                            process_one_work+0x1e0/0x5c0
                            worker_thread+0x44/0x390
                            kthread+0x102/0x140
                            ret_from_fork+0x3a/0x50
         INITIAL USE at:
                           down_write+0x3e/0xa0
                           cache_block_group+0x287/0x420 [btrfs]
                           find_free_extent+0x106c/0x12d0 [btrfs]
                           btrfs_reserve_extent+0xd8/0x170 [btrfs]
                           cow_file_range.isra.66+0x133/0x470 [btrfs]
                           run_delalloc_range+0x121/0x410 [btrfs]
                           writepage_delalloc.isra.50+0xfe/0x180 [btrfs]
                           __extent_writepage+0x19a/0x360 [btrfs]
                           extent_write_cache_pages.constprop.56+0x249/0x3e0 [btrfs]
                           extent_writepages+0x4d/0x60 [btrfs]
                           do_writepages+0x1a/0x70
                           __filemap_fdatawrite_range+0xa7/0xe0
                           btrfs_rename+0x5ee/0xdb0 [btrfs]
                           vfs_rename+0x52a/0x7e0
                           SyS_rename+0x351/0x3b0
                           do_syscall_64+0x79/0x1e0
                           entry_SYSCALL_64_after_hwframe+0x42/0xb7
       }
       ... key      at: [<ffffffffc0729578>] __key.61970+0x0/0xfffffffffff9aa88 [btrfs]
       ... acquired at:
       cache_block_group+0x287/0x420 [btrfs]
       find_free_extent+0x106c/0x12d0 [btrfs]
       btrfs_reserve_extent+0xd8/0x170 [btrfs]
       btrfs_alloc_tree_block+0x12f/0x4c0 [btrfs]
       btrfs_create_tree+0xbb/0x2a0 [btrfs]
       btrfs_create_uuid_tree+0x37/0x140 [btrfs]
       open_ctree+0x23c0/0x2660 [btrfs]
       btrfs_mount+0xd36/0xf90 [btrfs]
       mount_fs+0x3a/0x160
       vfs_kern_mount+0x66/0x150
       btrfs_mount+0x18c/0xf90 [btrfs]
       mount_fs+0x3a/0x160
       vfs_kern_mount+0x66/0x150
       do_mount+0x1c1/0xcc0
       SyS_mount+0x7e/0xd0
       do_syscall_64+0x79/0x1e0
       entry_SYSCALL_64_after_hwframe+0x42/0xb7
    
     -> (&found->groups_sem){++++..} ops: 2134587 {
        HARDIRQ-ON-W at:
                          down_write+0x3e/0xa0
                          __link_block_group+0x34/0x130 [btrfs]
                          btrfs_read_block_groups+0x33d/0x7b0 [btrfs]
                          open_ctree+0x2054/0x2660 [btrfs]
                          btrfs_mount+0xd36/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          btrfs_mount+0x18c/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          do_mount+0x1c1/0xcc0
                          SyS_mount+0x7e/0xd0
                          do_syscall_64+0x79/0x1e0
                          entry_SYSCALL_64_after_hwframe+0x42/0xb7
        HARDIRQ-ON-R at:
                          down_read+0x35/0x90
                          btrfs_calc_num_tolerated_disk_barrier_failures+0x113/0x1f0 [btrfs]
                          open_ctree+0x207b/0x2660 [btrfs]
                          btrfs_mount+0xd36/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          btrfs_mount+0x18c/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          do_mount+0x1c1/0xcc0
                          SyS_mount+0x7e/0xd0
                          do_syscall_64+0x79/0x1e0
                          entry_SYSCALL_64_after_hwframe+0x42/0xb7
        SOFTIRQ-ON-W at:
                          down_write+0x3e/0xa0
                          __link_block_group+0x34/0x130 [btrfs]
                          btrfs_read_block_groups+0x33d/0x7b0 [btrfs]
                          open_ctree+0x2054/0x2660 [btrfs]
                          btrfs_mount+0xd36/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          btrfs_mount+0x18c/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          do_mount+0x1c1/0xcc0
                          SyS_mount+0x7e/0xd0
                          do_syscall_64+0x79/0x1e0
                          entry_SYSCALL_64_after_hwframe+0x42/0xb7
        SOFTIRQ-ON-R at:
                          down_read+0x35/0x90
                          btrfs_calc_num_tolerated_disk_barrier_failures+0x113/0x1f0 [btrfs]
                          open_ctree+0x207b/0x2660 [btrfs]
                          btrfs_mount+0xd36/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          btrfs_mount+0x18c/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          do_mount+0x1c1/0xcc0
                          SyS_mount+0x7e/0xd0
                          do_syscall_64+0x79/0x1e0
                          entry_SYSCALL_64_after_hwframe+0x42/0xb7
        INITIAL USE at:
                         down_write+0x3e/0xa0
                         __link_block_group+0x34/0x130 [btrfs]
                         btrfs_read_block_groups+0x33d/0x7b0 [btrfs]
                         open_ctree+0x2054/0x2660 [btrfs]
                         btrfs_mount+0xd36/0xf90 [btrfs]
                         mount_fs+0x3a/0x160
                         vfs_kern_mount+0x66/0x150
                         btrfs_mount+0x18c/0xf90 [btrfs]
                         mount_fs+0x3a/0x160
                         vfs_kern_mount+0x66/0x150
                         do_mount+0x1c1/0xcc0
                         SyS_mount+0x7e/0xd0
                         do_syscall_64+0x79/0x1e0
                         entry_SYSCALL_64_after_hwframe+0x42/0xb7
      }
      ... key      at: [<ffffffffc0729488>] __key.59101+0x0/0xfffffffffff9ab78 [btrfs]
      ... acquired at:
       find_free_extent+0xcb4/0x12d0 [btrfs]
       btrfs_reserve_extent+0xd8/0x170 [btrfs]
       btrfs_alloc_tree_block+0x12f/0x4c0 [btrfs]
       __btrfs_cow_block+0x110/0x5b0 [btrfs]
       btrfs_cow_block+0xd7/0x290 [btrfs]
       btrfs_search_slot+0x1f6/0x960 [btrfs]
       btrfs_lookup_inode+0x2a/0x90 [btrfs]
       __btrfs_update_delayed_inode+0x65/0x210 [btrfs]
       btrfs_commit_inode_delayed_inode+0x121/0x130 [btrfs]
       btrfs_evict_inode+0x3fe/0x6a0 [btrfs]
       evict+0xc4/0x190
       __dentry_kill+0xbf/0x170
       dput+0x2ae/0x2f0
       SyS_rename+0x2a6/0x3b0
       do_syscall_64+0x79/0x1e0
       entry_SYSCALL_64_after_hwframe+0x42/0xb7
    
    -> (&delayed_node->mutex){+.+.-.} ops: 5580204 {
       HARDIRQ-ON-W at:
                        __mutex_lock+0x4e/0x8c0
                        btrfs_delayed_update_inode+0x46/0x6e0 [btrfs]
                        btrfs_update_inode+0x83/0x110 [btrfs]
                        btrfs_dirty_inode+0x62/0xe0 [btrfs]
                        touch_atime+0x8c/0xb0
                        do_generic_file_read+0x818/0xb10
                        __vfs_read+0xdc/0x150
                        vfs_read+0x8a/0x130
                        SyS_read+0x45/0xa0
                        do_syscall_64+0x79/0x1e0
                        entry_SYSCALL_64_after_hwframe+0x42/0xb7
       SOFTIRQ-ON-W at:
                        __mutex_lock+0x4e/0x8c0
                        btrfs_delayed_update_inode+0x46/0x6e0 [btrfs]
                        btrfs_update_inode+0x83/0x110 [btrfs]
                        btrfs_dirty_inode+0x62/0xe0 [btrfs]
                        touch_atime+0x8c/0xb0
                        do_generic_file_read+0x818/0xb10
                        __vfs_read+0xdc/0x150
                        vfs_read+0x8a/0x130
                        SyS_read+0x45/0xa0
                        do_syscall_64+0x79/0x1e0
                        entry_SYSCALL_64_after_hwframe+0x42/0xb7
       IN-RECLAIM_FS-W at:
                           __mutex_lock+0x4e/0x8c0
                           __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
                           btrfs_evict_inode+0x22c/0x6a0 [btrfs]
                           evict+0xc4/0x190
                           dispose_list+0x35/0x50
                           prune_icache_sb+0x42/0x50
                           super_cache_scan+0x139/0x190
                           shrink_slab+0x262/0x5b0
                           shrink_node+0x2eb/0x2f0
                           kswapd+0x2eb/0x890
                           kthread+0x102/0x140
                           ret_from_fork+0x3a/0x50
       INITIAL USE at:
                       __mutex_lock+0x4e/0x8c0
                       btrfs_delayed_update_inode+0x46/0x6e0 [btrfs]
                       btrfs_update_inode+0x83/0x110 [btrfs]
                       btrfs_dirty_inode+0x62/0xe0 [btrfs]
                       touch_atime+0x8c/0xb0
                       do_generic_file_read+0x818/0xb10
                       __vfs_read+0xdc/0x150
                       vfs_read+0x8a/0x130
                       SyS_read+0x45/0xa0
                       do_syscall_64+0x79/0x1e0
                       entry_SYSCALL_64_after_hwframe+0x42/0xb7
     }
     ... key      at: [<ffffffffc072d488>] __key.56935+0x0/0xfffffffffff96b78 [btrfs]
     ... acquired at:
       __lock_acquire+0x264/0x11c0
       lock_acquire+0xbd/0x1e0
       __mutex_lock+0x4e/0x8c0
       __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
       btrfs_evict_inode+0x22c/0x6a0 [btrfs]
       evict+0xc4/0x190
       dispose_list+0x35/0x50
       prune_icache_sb+0x42/0x50
       super_cache_scan+0x139/0x190
       shrink_slab+0x262/0x5b0
       shrink_node+0x2eb/0x2f0
       kswapd+0x2eb/0x890
       kthread+0x102/0x140
       ret_from_fork+0x3a/0x50
    
    stack backtrace:
    CPU: 1 PID: 50 Comm: kswapd0 Tainted: G        W        4.12.14-kvmsmall #8 SLE15 (unreleased)
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
    Call Trace:
     dump_stack+0x78/0xb7
     print_irq_inversion_bug.part.38+0x19f/0x1aa
     check_usage_forwards+0x102/0x120
     ? ret_from_fork+0x3a/0x50
     ? check_usage_backwards+0x110/0x110
     mark_lock+0x16c/0x270
     __lock_acquire+0x264/0x11c0
     ? pagevec_lookup_entries+0x1a/0x30
     ? truncate_inode_pages_range+0x2b3/0x7f0
     lock_acquire+0xbd/0x1e0
     ? __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
     __mutex_lock+0x4e/0x8c0
     ? __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
     ? __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
     ? btrfs_evict_inode+0x1f6/0x6a0 [btrfs]
     __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
     btrfs_evict_inode+0x22c/0x6a0 [btrfs]
     evict+0xc4/0x190
     dispose_list+0x35/0x50
     prune_icache_sb+0x42/0x50
     super_cache_scan+0x139/0x190
     shrink_slab+0x262/0x5b0
     shrink_node+0x2eb/0x2f0
     kswapd+0x2eb/0x890
     kthread+0x102/0x140
     ? mem_cgroup_shrink_node+0x2c0/0x2c0
     ? kthread_create_on_node+0x40/0x40
     ret_from_fork+0x3a/0x50
    
    Signed-off-by: Jeff Mahoney <jeffm@suse.com>
    Reviewed-by: Liu Bo <bo.liu@linux.alibaba.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 47ab05739d6c5b9492c0a12d284dd656fe2bf109
Author: Filipe Manana <fdmanana@suse.com>
Date:   Mon Mar 26 23:59:12 2018 +0100

    Btrfs: fix copy_items() return value when logging an inode
    
    [ Upstream commit 8434ec46c6e3232cebc25a910363b29f5c617820 ]
    
    When logging an inode, at tree-log.c:copy_items(), if we call
    btrfs_next_leaf() at the loop which checks for the need to log holes, we
    need to make sure copy_items() returns the value 1 to its caller and
    not 0 (on success). This is because the path the caller passed was
    released and is now different from what is was before, and the caller
    expects a return value of 0 to mean both success and that the path
    has not changed, while a return value of 1 means both success and
    signals the caller that it can not reuse the path, it has to perform
    another tree search.
    
    Even though this is a case that should not be triggered on normal
    circumstances or very rare at least, its consequences can be very
    unpredictable (especially when replaying a log tree).
    
    Fixes: 16e7549f045d ("Btrfs: incompatible format change to remove hole extents")
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d6ea3cae5827a2c2105f3fae3e7bad2b0048e48f
Author: Qu Wenruo <wqu@suse.com>
Date:   Tue Mar 27 20:44:18 2018 +0800

    btrfs: tests/qgroup: Fix wrong tree backref level
    
    [ Upstream commit 3c0efdf03b2d127f0e40e30db4e7aa0429b1b79a ]
    
    The extent tree of the test fs is like the following:
    
     BTRFS info (device (null)): leaf 16327509003777336587 total ptrs 1 free space 3919
      item 0 key (4096 168 4096) itemoff 3944 itemsize 51
              extent refs 1 gen 1 flags 2
              tree block key (68719476736 0 0) level 1
                                               ^^^^^^^
              ref#0: tree block backref root 5
    
    And it's using an empty tree for fs tree, so there is no way that its
    level can be 1.
    
    For REAL (created by mkfs) fs tree backref with no skinny metadata, the
    result should look like:
    
     item 3 key (30408704 EXTENT_ITEM 4096) itemoff 3845 itemsize 51
             refs 1 gen 4 flags TREE_BLOCK
             tree block key (256 INODE_ITEM 0) level 0
                                               ^^^^^^^
             tree block backref root 5
    
    Fix the level to 0, so it won't break later tree level checker.
    
    Fixes: faa2dbf004e8 ("Btrfs: add sanity tests for new qgroup accounting code")
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f29ea5cd50cea7a9698f8174e158f5a87d87ab38
Author: Nicholas Piggin <npiggin@gmail.com>
Date:   Tue Mar 27 01:01:16 2018 +1000

    powerpc/64s: sreset panic if there is no debugger or crash dump handlers
    
    [ Upstream commit d40b6768e45bd9213139b2d91d30c7692b6007b1 ]
    
    system_reset_exception does most of its own crash handling now,
    invoking the debugger or crash dumps if they are registered. If not,
    then it goes through to die() to print stack traces, and then is
    supposed to panic (according to comments).
    
    However after die() prints oopses, it does its own handling which
    doesn't allow system_reset_exception to panic (e.g., it may just
    kill the current process). This patch causes sreset exceptions to
    return from die after it prints messages but before acting.
    
    This also stops die from invoking the debugger on 0x100 crashes.
    system_reset_exception similarly calls the debugger. It had been
    thought this was harmless (because if the debugger was disabled,
    neither call would fire, and if it was enabled the first call
    would return). However in some cases like xmon 'X' command, the
    debugger returns 0, which currently causes it to be entered
    again (first in system_reset_exception, then in die), which is
    confusing.
    
    Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f80a0f02a5bb17afd7be1d776e2a640c1699ec35
Author: Scott Branden <scott.branden@broadcom.com>
Date:   Sat Mar 31 13:54:09 2018 -0400

    bnxt_en: fix clear flags in ethtool reset handling
    
    [ Upstream commit 2373d8d6a7932d28b8e31ea2a70bf6c002d97ac8 ]
    
    Clear flags when reset command processed successfully for components
    specified.
    
    Fixes: 6502ad5963a5 ("bnxt_en: Add ETH_RESET_AP support")
    Signed-off-by: Scott Branden <scott.branden@broadcom.com>
    Signed-off-by: Michael Chan <michael.chan@broadcom.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b723715bd89767e10f336d733919de9556f69e42
Author: Florian Fainelli <f.fainelli@gmail.com>
Date:   Sun Apr 1 10:26:29 2018 -0700

    net: bgmac: Correctly annotate register space
    
    [ Upstream commit 16a1c0646e55c3345bce8e4edfc06ad119d27c04 ]
    
    All the members: base, idm_base and nicpm_base should be annotated with
    __iomem since they are pointers to register space. This fixes a bunch of
    sparse reported warnings.
    
    Fixes: f6a95a24957a ("net: ethernet: bgmac: Add platform device support")
    Fixes: dd5c5d037f5e ("net: ethernet: bgmac: add NS2 support")
    Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8a77c0c25e90c23727dddb5cc46daaced717da29
Author: Florian Fainelli <f.fainelli@gmail.com>
Date:   Sun Apr 1 10:26:30 2018 -0700

    net: bgmac: Fix endian access in bgmac_dma_tx_ring_free()
    
    [ Upstream commit 60d6e6f0b9e422dd01aeda39257ee0428e5e2a3f ]
    
    bgmac_dma_tx_ring_free() assigns the ctl1 word which is a litle endian
    32-bit word without using proper accessors, fix this, and because a
    length cannot be negative, use unsigned int while at it.
    
    Fixes: 9cde94506eac ("bgmac: implement scatter/gather support")
    Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e093a9469e335fa3d39a2472086a527c4ed8343c
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Fri Mar 16 15:10:15 2018 +0300

    platform/x86: dell-smbios: Fix memory leaks in build_tokens_sysfs()
    
    [ Upstream commit 0e5b09b165510e2ea5c526e962c4edadd849ef4c ]
    
    We're freeing "value_name" which is NULL, so that's a no-op, but we
    intended to free "location_name" instead.  And then we don't free the
    names in token_location_attrs[0] and token_value_attrs[0].
    
    Fixes: 33b9ca1e53b4 ("platform/x86: dell-smbios: Add a sysfs interface for SMBIOS tokens")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f0d098569a0ab4ec3c2f59ef2827d46e798ce789
Author: Andrea Parri <parri.andrea@gmail.com>
Date:   Fri Mar 9 13:13:20 2018 +0100

    riscv/spinlock: Strengthen implementations with fences
    
    [ Upstream commit 0123f4d76ca63b7b895f40089be0ce4809e392d8 ]
    
    Current implementations map locking operations using .rl and .aq
    annotations.  However, this mapping is unsound w.r.t. the kernel
    memory consistency model (LKMM) [1]:
    
    Referring to the "unlock-lock-read-ordering" test reported below,
    Daniel wrote:
    
      "I think an RCpc interpretation of .aq and .rl would in fact
       allow the two normal loads in P1 to be reordered [...]
    
       The intuition would be that the amoswap.w.aq can forward from
       the amoswap.w.rl while that's still in the store buffer, and
       then the lw x3,0(x4) can also perform while the amoswap.w.rl
       is still in the store buffer, all before the l1 x1,0(x2)
       executes.  That's not forbidden unless the amoswaps are RCsc,
       unless I'm missing something.
    
       Likewise even if the unlock()/lock() is between two stores.
       A control dependency might originate from the load part of
       the amoswap.w.aq, but there still would have to be something
       to ensure that this load part in fact performs after the store
       part of the amoswap.w.rl performs globally, and that's not
       automatic under RCpc."
    
    Simulation of the RISC-V memory consistency model confirmed this
    expectation.
    
    In order to "synchronize" LKMM and RISC-V's implementation, this
    commit strengthens the implementations of the locking operations
    by replacing .rl and .aq with the use of ("lightweigth") fences,
    resp., "fence rw,  w" and "fence r , rw".
    
    C unlock-lock-read-ordering
    
    {}
    /* s initially owned by P1 */
    
    P0(int *x, int *y)
    {
            WRITE_ONCE(*x, 1);
            smp_wmb();
            WRITE_ONCE(*y, 1);
    }
    
    P1(int *x, int *y, spinlock_t *s)
    {
            int r0;
            int r1;
    
            r0 = READ_ONCE(*y);
            spin_unlock(s);
            spin_lock(s);
            r1 = READ_ONCE(*x);
    }
    
    exists (1:r0=1 /\ 1:r1=0)
    
    [1] https://marc.info/?l=linux-kernel&m=151930201102853&w=2
        https://groups.google.com/a/groups.riscv.org/forum/#!topic/isa-dev/hKywNHBkAXM
        https://marc.info/?l=linux-kernel&m=151633436614259&w=2
    
    Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
    Cc: Palmer Dabbelt <palmer@sifive.com>
    Cc: Albert Ou <albert@sifive.com>
    Cc: Daniel Lustig <dlustig@nvidia.com>
    Cc: Alan Stern <stern@rowland.harvard.edu>
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Boqun Feng <boqun.feng@gmail.com>
    Cc: Nicholas Piggin <npiggin@gmail.com>
    Cc: David Howells <dhowells@redhat.com>
    Cc: Jade Alglave <j.alglave@ucl.ac.uk>
    Cc: Luc Maranget <luc.maranget@inria.fr>
    Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
    Cc: Akira Yokosawa <akiyks@gmail.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: linux-riscv@lists.infradead.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 98964714c2c16f9d444920dcd3c762a698d02f46
Author: David S. Miller <davem@davemloft.net>
Date:   Tue Apr 3 08:24:35 2018 -0700

    sparc64: Make atomic_xchg() an inline function rather than a macro.
    
    [ Upstream commit d13864b68e41c11e4231de90cf358658f6ecea45 ]
    
    This avoids a lot of -Wunused warnings such as:
    
    ====================
    kernel/debug/debug_core.c: In function ‘kgdb_cpu_enter’:
    ./arch/sparc/include/asm/cmpxchg_64.h:55:22: warning: value computed is not used [-Wunused-value]
     #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
    
    ./arch/sparc/include/asm/atomic_64.h:86:30: note: in expansion of macro ‘xchg’
     #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
                                  ^~~~
    kernel/debug/debug_core.c:508:4: note: in expansion of macro ‘atomic_xchg’
        atomic_xchg(&kgdb_active, cpu);
        ^~~~~~~~~~~
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8b1d945b2cada1178749a5398ece69ae0088dc6b
Author: Geert Uytterhoeven <geert+renesas@glider.be>
Date:   Thu Mar 29 18:53:32 2018 +0200

    dmaengine: rcar-dmac: Fix too early/late system suspend/resume callbacks
    
    [ Upstream commit 73dcc666d6bd0db56cd556010f93d8f04c1cc70c ]
    
    If serial console wake-up is enabled ("echo enabled >
    /sys/.../ttySC0/power/wakeup"), and any serial input is received while
    the system is suspended, serial port input no longer works after system
    resume.
    
    Note that:
      1) The system can still be woken up using the serial console,
      2) Serial port input keeps working if the system is woken up in some
         other way (e.g. Wake-on-LAN or gpio-keys), and no serial input was
         received while suspended.
    
    To fix this, replace SET_LATE_SYSTEM_SLEEP_PM_OPS() by
    SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(), as the callbacks installed by the
    former happen too early resp. late in the suspend resp. resume process.
    
    Reported-by: RVC test team via Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Fixes: 1131b0a4af911de5 ("dmaengine: rcar-dmac: Make DMAC reinit during system resume explicit")
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Vinod Koul <vinod.koul@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5253912852ce42e5e7db91797dadcb6d82f15289
Author: David Howells <dhowells@redhat.com>
Date:   Wed Apr 4 13:41:26 2018 +0100

    fscache: Fix hanging wait on page discarded by writeback
    
    [ Upstream commit 2c98425720233ae3e135add0c7e869b32913502f ]
    
    If the fscache asynchronous write operation elects to discard a page that's
    pending storage to the cache because the page would be over the store limit
    then it needs to wake the page as someone may be waiting on completion of
    the write.
    
    The problem is that the store limit may be updated by a different
    asynchronous operation - and so may miss the write - and that the store
    limit may not even get updated until later by the netfs.
    
    Fix the kernel hang by making fscache_write_op() mark as written any pages
    that are over the limit.
    
    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1b6d3ac3f5ec27cf05e97619108eb23910008f68
Author: Alexander Graf <agraf@suse.de>
Date:   Wed Apr 4 00:19:35 2018 +0200

    lan78xx: Connect phy early
    
    [ Upstream commit 92571a1aae40d291158d16e7142637908220f470 ]
    
    When using wicked with a lan78xx device attached to the system, we
    end up with ethtool commands issued on the device before an ifup
    got issued. That lead to the following crash:
    
        Unable to handle kernel NULL pointer dereference at virtual address 0000039c
        pgd = ffff800035b30000
        [0000039c] *pgd=0000000000000000
        Internal error: Oops: 96000004 [#1] SMP
        Modules linked in: [...]
        Supported: Yes
        CPU: 3 PID: 638 Comm: wickedd Tainted: G            E      4.12.14-0-default #1
        Hardware name: raspberrypi rpi/rpi, BIOS 2018.03-rc2 02/21/2018
        task: ffff800035e74180 task.stack: ffff800036718000
        PC is at phy_ethtool_ksettings_get+0x20/0x98
        LR is at lan78xx_get_link_ksettings+0x44/0x60 [lan78xx]
        pc : [<ffff0000086f7f30>] lr : [<ffff000000dcca84>] pstate: 20000005
        sp : ffff80003671bb20
        x29: ffff80003671bb20 x28: ffff800035e74180
        x27: ffff000008912000 x26: 000000000000001d
        x25: 0000000000000124 x24: ffff000008f74d00
        x23: 0000004000114809 x22: 0000000000000000
        x21: ffff80003671bbd0 x20: 0000000000000000
        x19: ffff80003671bbd0 x18: 000000000000040d
        x17: 0000000000000001 x16: 0000000000000000
        x15: 0000000000000000 x14: ffffffffffffffff
        x13: 0000000000000000 x12: 0000000000000020
        x11: 0101010101010101 x10: fefefefefefefeff
        x9 : 7f7f7f7f7f7f7f7f x8 : fefefeff31677364
        x7 : 0000000080808080 x6 : ffff80003671bc9c
        x5 : ffff80003671b9f8 x4 : ffff80002c296190
        x3 : 0000000000000000 x2 : 0000000000000000
        x1 : ffff80003671bbd0 x0 : ffff80003671bc00
        Process wickedd (pid: 638, stack limit = 0xffff800036718000)
        Call trace:
        Exception stack(0xffff80003671b9e0 to 0xffff80003671bb20)
        b9e0: ffff80003671bc00 ffff80003671bbd0 0000000000000000 0000000000000000
        ba00: ffff80002c296190 ffff80003671b9f8 ffff80003671bc9c 0000000080808080
        ba20: fefefeff31677364 7f7f7f7f7f7f7f7f fefefefefefefeff 0101010101010101
        ba40: 0000000000000020 0000000000000000 ffffffffffffffff 0000000000000000
        ba60: 0000000000000000 0000000000000001 000000000000040d ffff80003671bbd0
        ba80: 0000000000000000 ffff80003671bbd0 0000000000000000 0000004000114809
        baa0: ffff000008f74d00 0000000000000124 000000000000001d ffff000008912000
        bac0: ffff800035e74180 ffff80003671bb20 ffff000000dcca84 ffff80003671bb20
        bae0: ffff0000086f7f30 0000000020000005 ffff80002c296000 ffff800035223900
        bb00: 0000ffffffffffff 0000000000000000 ffff80003671bb20 ffff0000086f7f30
        [<ffff0000086f7f30>] phy_ethtool_ksettings_get+0x20/0x98
        [<ffff000000dcca84>] lan78xx_get_link_ksettings+0x44/0x60 [lan78xx]
        [<ffff0000087cbc40>] ethtool_get_settings+0x68/0x210
        [<ffff0000087cc0d4>] dev_ethtool+0x214/0x2180
        [<ffff0000087e5008>] dev_ioctl+0x400/0x630
        [<ffff00000879dd00>] sock_do_ioctl+0x70/0x88
        [<ffff00000879f5f8>] sock_ioctl+0x208/0x368
        [<ffff0000082cde10>] do_vfs_ioctl+0xb0/0x848
        [<ffff0000082ce634>] SyS_ioctl+0x8c/0xa8
        Exception stack(0xffff80003671bec0 to 0xffff80003671c000)
        bec0: 0000000000000009 0000000000008946 0000fffff4e841d0 0000aa0032687465
        bee0: 0000aaaafa2319d4 0000fffff4e841d4 0000000032687465 0000000032687465
        bf00: 000000000000001d 7f7fff7f7f7f7f7f 72606b622e71ff4c 7f7f7f7f7f7f7f7f
        bf20: 0101010101010101 0000000000000020 ffffffffffffffff 0000ffff7f510c68
        bf40: 0000ffff7f6a9d18 0000ffff7f44ce30 000000000000040d 0000ffff7f6f98f0
        bf60: 0000fffff4e842c0 0000000000000001 0000aaaafa2c2e00 0000ffff7f6ab000
        bf80: 0000fffff4e842c0 0000ffff7f62a000 0000aaaafa2b9f20 0000aaaafa2c2e00
        bfa0: 0000fffff4e84818 0000fffff4e841a0 0000ffff7f5ad0cc 0000fffff4e841a0
        bfc0: 0000ffff7f44ce3c 0000000080000000 0000000000000009 000000000000001d
        bfe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    
    The culprit is quite simple: The driver tries to access the phy left and right,
    but only actually has a working reference to it when the device is up.
    
    The fix thus is quite simple too: Get a reference to the phy on probe already
    and keep it even when the device is going down.
    
    With this patch applied, I can successfully run wicked on my system and bring
    the interface up and down as many times as I want, without getting NULL pointer
    dereferences in between.
    
    Signed-off-by: Alexander Graf <agraf@suse.de>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4c30444e3382cf6342476d0b758e5433d65e975c
Author: Sean Christopherson <sean.j.christopherson@intel.com>
Date:   Fri Mar 23 09:34:00 2018 -0700

    KVM: VMX: raise internal error for exception during invalid protected mode state
    
    [ Upstream commit add5ff7a216ee545a214013f26d1ef2f44a9c9f8 ]
    
    Exit to userspace with KVM_INTERNAL_ERROR_EMULATION if we encounter
    an exception in Protected Mode while emulating guest due to invalid
    guest state.  Unlike Big RM, KVM doesn't support emulating exceptions
    in PM, i.e. PM exceptions are always injected via the VMCS.  Because
    we will never do VMRESUME due to emulation_required, the exception is
    never realized and we'll keep emulating the faulting instruction over
    and over until we receive a signal.
    
    Exit to userspace iff there is a pending exception, i.e. don't exit
    simply on a requested event. The purpose of this check and exit is to
    aid in debugging a guest that is in all likelihood already doomed.
    Invalid guest state in PM is extremely limited in normal operation,
    e.g. it generally only occurs for a few instructions early in BIOS,
    and any exception at this time is all but guaranteed to be fatal.
    Non-vectored interrupts, e.g. INIT, SIPI and SMI, can be cleanly
    handled/emulated, while checking for vectored interrupts, e.g. INTR
    and NMI, without hitting false positives would add a fair amount of
    complexity for almost no benefit (getting hit by lightning seems
    more likely than encountering this specific scenario).
    
    Add a WARN_ON_ONCE to vmx_queue_exception() if we try to inject an
    exception via the VMCS and emulation_required is true.
    
    Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
    Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 98fe5807e7b28e2af4dab77e4c4acc713f4e7be8
Author: Sai Praneeth <sai.praneeth.prakhya@intel.com>
Date:   Wed Apr 4 12:34:19 2018 -0700

    x86/mm: Fix bogus warning during EFI bootup, use boot_cpu_has() instead of this_cpu_has() in build_cr3_noflush()
    
    [ Upstream commit 162ee5a8ab49be40d253f90e94aef712470a3a24 ]
    
    Linus reported the following boot warning:
    
      WARNING: CPU: 0 PID: 0 at arch/x86/include/asm/tlbflush.h:134 load_new_mm_cr3+0x114/0x170
      [...]
      Call Trace:
      switch_mm_irqs_off+0x267/0x590
      switch_mm+0xe/0x20
      efi_switch_mm+0x3e/0x50
      efi_enter_virtual_mode+0x43f/0x4da
      start_kernel+0x3bf/0x458
      secondary_startup_64+0xa5/0xb0
    
    ... after merging:
    
      03781e40890c: x86/efi: Use efi_switch_mm() rather than manually twiddling with %cr3
    
    When the platform supports PCID and if CONFIG_DEBUG_VM=y is enabled,
    build_cr3_noflush() (called via switch_mm()) does a sanity check to see
    if X86_FEATURE_PCID is set.
    
    Presently, build_cr3_noflush() uses "this_cpu_has(X86_FEATURE_PCID)" to
    perform the check but this_cpu_has() works only after SMP is initialized
    (i.e. per cpu cpu_info's should be populated) and this happens to be very
    late in the boot process (during rest_init()).
    
    As efi_runtime_services() are called during (early) kernel boot time
    and run time, modify build_cr3_noflush() to use boot_cpu_has() all the
    time. As suggested by Dave Hansen, this should be OK because all CPU's have
    same capabilities on x86.
    
    With this change the warning is fixed.
    
    ( Dave also suggested that we put a warning in this_cpu_has() if it's used
      early in the boot process. This is still work in progress as it affects
      MCE. )
    
    Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: Lee Chun-Yi <jlee@suse.com>
    Cc: Matt Fleming <matt@codeblueprint.co.uk>
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Ravi Shankar <ravi.v.shankar@intel.com>
    Cc: Ricardo Neri <ricardo.neri@intel.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Tony Luck <tony.luck@intel.com>
    Cc: linux-efi@vger.kernel.org
    Link: http://lkml.kernel.org/r/1522870459-7432-1-git-send-email-sai.praneeth.prakhya@intel.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ddd72f06c2c9d12d4d950f43e7fdd727a3d4fd96
Author: Davidlohr Bueso <dave@stgolabs.net>
Date:   Mon Apr 2 09:49:54 2018 -0700

    sched/rt: Fix rq->clock_update_flags < RQCF_ACT_SKIP warning
    
    [ Upstream commit d29a20645d5e929aa7e8616f28e5d8e1c49263ec ]
    
    While running rt-tests' pi_stress program I got the following splat:
    
      rq->clock_update_flags < RQCF_ACT_SKIP
      WARNING: CPU: 27 PID: 0 at kernel/sched/sched.h:960 assert_clock_updated.isra.38.part.39+0x13/0x20
    
      [...]
    
      <IRQ>
      enqueue_top_rt_rq+0xf4/0x150
      ? cpufreq_dbs_governor_start+0x170/0x170
      sched_rt_rq_enqueue+0x65/0x80
      sched_rt_period_timer+0x156/0x360
      ? sched_rt_rq_enqueue+0x80/0x80
      __hrtimer_run_queues+0xfa/0x260
      hrtimer_interrupt+0xcb/0x220
      smp_apic_timer_interrupt+0x62/0x120
      apic_timer_interrupt+0xf/0x20
      </IRQ>
    
      [...]
    
      do_idle+0x183/0x1e0
      cpu_startup_entry+0x5f/0x70
      start_secondary+0x192/0x1d0
      secondary_startup_64+0xa5/0xb0
    
    We can get rid of it be the "traditional" means of adding an
    update_rq_clock() call after acquiring the rq->lock in
    do_sched_rt_period_timer().
    
    The case for the RT task throttling (which this workload also hits)
    can be ignored in that the skip_update call is actually bogus and
    quite the contrary (the request bits are removed/reverted).
    
    By setting RQCF_UPDATED we really don't care if the skip is happening
    or not and will therefore make the assert_clock_updated() check happy.
    
    Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
    Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: dave@stgolabs.net
    Cc: linux-kernel@vger.kernel.org
    Cc: rostedt@goodmis.org
    Link: http://lkml.kernel.org/r/20180402164954.16255-1-dave@stgolabs.net
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0d55244c947754d13d78d4f8f9420516b758d666
Author: Nicholas Piggin <npiggin@gmail.com>
Date:   Thu Apr 5 16:10:00 2018 +1000

    powerpc/64s/idle: Fix restore of AMOR on POWER9 after deep sleep
    
    [ Upstream commit c1b25a17d24925b0961c319cfc3fd7e1dc778914 ]
    
    POWER8 restores AMOR when waking from deep sleep, but POWER9 does not,
    because it does not go through the subcore restore.
    
    Have POWER9 restore it in core restore.
    
    Fixes: ee97b6b99f42 ("powerpc/mm/radix: Setup AMOR in HV mode to allow key 0")
    Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f0bc31527aeb1374c46fbeec5d51d9ffb98d9c56
Author: Jun Piao <piaojun@huawei.com>
Date:   Thu Apr 5 16:18:48 2018 -0700

    ocfs2/dlm: don't handle migrate lockres if already in shutdown
    
    [ Upstream commit bb34f24c7d2c98d0c81838a7700e6068325b17a0 ]
    
    We should not handle migrate lockres if we are already in
    'DLM_CTXT_IN_SHUTDOWN', as that will cause lockres remains after leaving
    dlm domain.  At last other nodes will get stuck into infinite loop when
    requsting lock from us.
    
    The problem is caused by concurrency umount between nodes.  Before
    receiveing N1's DLM_BEGIN_EXIT_DOMAIN_MSG, N2 has picked up N1 as the
    migrate target.  So N2 will continue sending lockres to N1 even though
    N1 has left domain.
    
            N1                             N2 (owner)
                                           touch file
    
        access the file,
        and get pr lock
    
                                           begin leave domain and
                                           pick up N1 as new owner
    
        begin leave domain and
        migrate all lockres done
    
                                           begin migrate lockres to N1
    
        end leave domain, but
        the lockres left
        unexpectedly, because
        migrate task has passed
    
    [piaojun@huawei.com: v3]
      Link: http://lkml.kernel.org/r/5A9CBD19.5020107@huawei.com
    Link: http://lkml.kernel.org/r/5A99F028.2090902@huawei.com
    Signed-off-by: Jun Piao <piaojun@huawei.com>
    Reviewed-by: Yiwen Jiang <jiangyiwen@huawei.com>
    Reviewed-by: Joseph Qi <jiangqi903@gmail.com>
    Reviewed-by: Changwei Ge <ge.changwei@h3c.com>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Junxiao Bi <junxiao.bi@oracle.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 93347b058fc4045a6244a70b7eaf7c4ae2b5d9d5
Author: Mikhail Malygin <mikhail@malygin.me>
Date:   Mon Apr 2 12:26:59 2018 +0300

    IB/rxe: Fix for oops in rxe_register_device on ppc64le arch
    
    [ Upstream commit efc365e7290d040fbd43f60b0e97653489a739d4 ]
    
    On ppc64le arch rxe_add command causes oops in kernel log:
    
    [   92.495140] Oops: Kernel access of bad area, sig: 11 [#1]
    [   92.499710] SMP NR_CPUS=2048 NUMA pSeries
    [   92.499792] Modules linked in: ipt_MASQUERADE(E) nf_nat_masquerade_ipv4(E) nf_conntrack_netlink(E) nfnetlink(E) xfrm_user(E) iptable
    _nat(E) nf_conntrack_ipv4(E) nf_defrag_ipv4(E) nf_nat_ipv4(E) xt_addrtype(E) iptable_filter(E) ip_tables(E) xt_conntrack(E) x_tables(E)
     nf_nat(E) nf_conntrack(E) br_netfilter(E) bridge(E) stp(E) llc(E) overlay(E) af_packet(E) rpcrdma(E) ib_isert(E) iscsi_target_mod(E) i
    b_iser(E) libiscsi(E) ib_srpt(E) target_core_mod(E) ib_srp(E) ib_ipoib(E) rdma_ucm(E) ib_ucm(E) ib_uverbs(E) ib_umad(E) bochs_drm(E) tt
    m(E) drm_kms_helper(E) syscopyarea(E) sysfillrect(E) sysimgblt(E) fb_sys_fops(E) drm(E) agpgart(E) virtio_rng(E) virtio_console(E) rtc_
    generic(E) dm_ec(OEN) ttln_rdma(OEN) rdma_cm(E) configfs(E) iw_cm(E) ib_cm(E) rdma_rxe(E) ip6_udp_tunnel(E) udp_tunnel(E) ib_core(E) ql
    a2xxx(E)
    [   92.499832]  scsi_transport_fc(E) nvme_fc(E) nvme_fabrics(E) nvme_core(E) ipmi_watchdog(E) ipmi_ssif(E) ipmi_poweroff(E) ipmi_powernv(EX) ipmi_devintf(E) ipmi_msghandler(E) dummy(E) ext4(E) crc16(E) jbd2(E) mbcache(E) dm_service_time(E) scsi_transport_iscsi(E) sd_mod(E) sr_mod(E) cdrom(E) hid_generic(E) usbhid(E) virtio_blk(E) virtio_scsi(E) virtio_net(E) ibmvscsi(EX) scsi_transport_srp(E) xhci_pci(E) xhci_hcd(E) usbcore(E) usb_common(E) virtio_pci(E) virtio_ring(E) virtio(E) sunrpc(E) dm_mirror(E) dm_region_hash(E) dm_log(E) sg(E) dm_multipath(E) dm_mod(E) scsi_dh_rdac(E) scsi_dh_emc(E) scsi_dh_alua(E) scsi_mod(E) autofs4(E)
    [   92.499834] Supported: No, Unsupported modules are loaded
    [   92.499839] CPU: 3 PID: 5576 Comm: sh Tainted: G           OE   NX 4.4.120-ttln.17-default #1
    [   92.499841] task: c0000000afe8a490 ti: c0000000beba8000 task.ti: c0000000beba8000
    [   92.499842] NIP: c00000000008ba3c LR: c000000000027644 CTR: c00000000008ba10
    [   92.499844] REGS: c0000000bebab750 TRAP: 0300   Tainted: G           OE   NX  (4.4.120-ttln.17-default)
    [   92.499850] MSR: 8000000000009033 <SF,EE,ME,IR,DR,RI,LE>  CR: 28424428  XER: 20000000
    [   92.499871] CFAR: 0000000000002424 DAR: 0000000000000208 DSISR: 40000000 SOFTE: 1
                   GPR00: c000000000027644 c0000000bebab9d0 c000000000f09700 0000000000000000
                   GPR04: d0000000043d7192 0000000000000002 000000000000001a fffffffffffffffe
                   GPR08: 000000000000009c c00000000008ba10 d0000000043e5848 d0000000043d3828
                   GPR12: c00000000008ba10 c000000007a02400 0000000010062e38 0000010020388860
                   GPR16: 0000000000000000 0000000000000000 00000100203885f0 00000000100f6c98
                   GPR20: c0000000b3f1fcc0 c0000000b3f1fc48 c0000000b3f1fbd0 c0000000b3f1fb58
                   GPR24: c0000000b3f1fae0 c0000000b3f1fa68 00000000000005dc c0000000b3f1f9f0
                   GPR28: d0000000043e5848 c0000000b3f1f900 c0000000b3f1f320 c0000000b3f1f000
    [   92.499881] NIP [c00000000008ba3c] dma_get_required_mask_pSeriesLP+0x2c/0x1a0
    [   92.499885] LR [c000000000027644] dma_get_required_mask+0x44/0xac
    [   92.499886] Call Trace:
    [   92.499891] [c0000000bebab9d0] [c0000000bebaba30] 0xc0000000bebaba30 (unreliable)
    [   92.499894] [c0000000bebaba10] [c000000000027644] dma_get_required_mask+0x44/0xac
    [   92.499904] [c0000000bebaba30] [d0000000043cb4b4] rxe_register_device+0xc4/0x430 [rdma_rxe]
    [   92.499910] [c0000000bebabab0] [d0000000043c06c8] rxe_add+0x448/0x4e0 [rdma_rxe]
    [   92.499915] [c0000000bebabb30] [d0000000043d28dc] rxe_net_add+0x4c/0xf0 [rdma_rxe]
    [   92.499921] [c0000000bebabb60] [d0000000043d305c] rxe_param_set_add+0x6c/0x1ac [rdma_rxe]
    [   92.499924] [c0000000bebabbf0] [c0000000000e78c0] param_attr_store+0xa0/0x180
    [   92.499927] [c0000000bebabc70] [c0000000000e6448] module_attr_store+0x48/0x70
    [   92.499932] [c0000000bebabc90] [c000000000391f60] sysfs_kf_write+0x70/0xb0
    [   92.499935] [c0000000bebabcb0] [c000000000390f1c] kernfs_fop_write+0x18c/0x1e0
    [   92.499939] [c0000000bebabd00] [c0000000002e22ac] __vfs_write+0x4c/0x1d0
    [   92.499942] [c0000000bebabd90] [c0000000002e2f94] vfs_write+0xc4/0x200
    [   92.499945] [c0000000bebabde0] [c0000000002e488c] SyS_write+0x6c/0x110
    [   92.499948] [c0000000bebabe30] [c000000000009384] system_call+0x38/0xe4
    [   92.499949] Instruction dump:
    [   92.499954] 4e800020 3c4c00e8 3842dcf0 7c0802a6 f8010010 60000000 7c0802a6 fba1ffe8
    [   92.499958] fbc1fff0 fbe1fff8 f8010010 f821ffc1 <e9230208> 7c7e1b78 2fa90000 419e0078
    [   92.499962] ---[ end trace bed077e15eb420cf ]---
    
    It fails in dma_get_required_mask, that has ppc-specific implementation,
    and fail if provided device argument is NULL
    
    Signed-off-by: Mikhail Malygin <mikhail@malygin.me>
    Reviewed-by: Yonatan Cohen <yonatanc@mellanox.com>
    Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5764e6af617e33e23b80bf0468dbb18ceb9ac588
Author: Nikolay Borisov <nborisov@suse.com>
Date:   Thu Apr 5 10:40:15 2018 +0300

    btrfs: Fix possible softlock on single core machines
    
    [ Upstream commit 1e1c50a929bc9e49bc3f9935b92450d9e69f8158 ]
    
    do_chunk_alloc implements a loop checking whether there is a pending
    chunk allocation and if so causes the caller do loop. Generally this
    loop is executed only once, however testing with btrfs/072 on a single
    core vm machines uncovered an extreme case where the system could loop
    indefinitely. This is due to a missing cond_resched when loop which
    doesn't give a chance to the previous chunk allocator finish its job.
    
    The fix is to simply add the missing cond_resched.
    
    Fixes: 6d74119f1a3e ("Btrfs: avoid taking the chunk_mutex in do_chunk_alloc")
    Signed-off-by: Nikolay Borisov <nborisov@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b7aea812123406e7880599644f9c9f36c5a24eed
Author: Liu Bo <bo.liu@linux.alibaba.com>
Date:   Tue Apr 3 01:59:47 2018 +0800

    Btrfs: fix NULL pointer dereference in log_dir_items
    
    [ Upstream commit 80c0b4210a963e31529e15bf90519708ec947596 ]
    
    0, 1 and <0 can be returned by btrfs_next_leaf(), and when <0 is
    returned, path->nodes[0] could be NULL, log_dir_items lacks such a
    check for <0 and we may run into a null pointer dereference panic.
    
    Fixes: e02119d5a7b4 ("Btrfs: Add a write ahead tree log to optimize synchronous operations")
    Reviewed-by: Nikolay Borisov <nborisov@suse.com>
    Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fdfa92756ec65ba0836bb9fc7d644b0c268515ba
Author: Liu Bo <bo.liu@linux.alibaba.com>
Date:   Tue Apr 3 01:59:48 2018 +0800

    Btrfs: bail out on error during replay_dir_deletes
    
    [ Upstream commit b98def7ca6e152ee55e36863dddf6f41f12d1dc6 ]
    
    If errors were returned by btrfs_next_leaf(), replay_dir_deletes needs
    to bail out, otherwise @ret would be forced to be 0 after 'break;' and
    the caller won't be aware of it.
    
    Fixes: e02119d5a7b4 ("Btrfs: Add a write ahead tree log to optimize synchronous operations")
    Reviewed-by: Nikolay Borisov <nborisov@suse.com>
    Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0d41ad15b659d9ad7bbfa9698ce3830b6ad43d83
Author: Yang Shi <yang.shi@linux.alibaba.com>
Date:   Thu Apr 5 16:22:35 2018 -0700

    mm: thp: fix potential clearing to referenced flag in page_idle_clear_pte_refs_one()
    
    [ Upstream commit f0849ac0b8e072073ec5fcc7fadd05a77434364e ]
    
    For PTE-mapped THP, the compound THP has not been split to normal 4K
    pages yet, the whole THP is considered referenced if any one of sub page
    is referenced.
    
    When walking PTE-mapped THP by pvmw, all relevant PTEs will be checked
    to retrieve referenced bit.  But, the current code just returns the
    result of the last PTE.  If the last PTE has not referenced, the
    referenced flag will be cleared.
    
    Just set referenced when ptep{pmdp}_clear_young_notify() returns true.
    
    Link: http://lkml.kernel.org/r/1518212451-87134-1-git-send-email-yang.shi@linux.alibaba.com
    Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>
    Reported-by: Gang Deng <gavin.dg@linux.alibaba.com>
    Suggested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ae7483b0731252ac4dd58f213a153770721e4a8c
Author: Huang Ying <ying.huang@intel.com>
Date:   Thu Apr 5 16:23:20 2018 -0700

    mm: fix races between address_space dereference and free in page_evicatable
    
    [ Upstream commit e92bb4dd9673945179b1fc738c9817dd91bfb629 ]
    
    When page_mapping() is called and the mapping is dereferenced in
    page_evicatable() through shrink_active_list(), it is possible for the
    inode to be truncated and the embedded address space to be freed at the
    same time.  This may lead to the following race.
    
    CPU1                                                CPU2
    
    truncate(inode)                                     shrink_active_list()
      ...                                                 page_evictable(page)
      truncate_inode_page(mapping, page);
        delete_from_page_cache(page)
          spin_lock_irqsave(&mapping->tree_lock, flags);
            __delete_from_page_cache(page, NULL)
              page_cache_tree_delete(..)
                ...                                         mapping = page_mapping(page);
                page->mapping = NULL;
                ...
          spin_unlock_irqrestore(&mapping->tree_lock, flags);
          page_cache_free_page(mapping, page)
            put_page(page)
              if (put_page_testzero(page)) -> false
    - inode now has no pages and can be freed including embedded address_space
    
                                                            mapping_unevictable(mapping)
                                                              test_bit(AS_UNEVICTABLE, &mapping->flags);
    - we've dereferenced mapping which is potentially already free.
    
    Similar race exists between swap cache freeing and page_evicatable()
    too.
    
    The address_space in inode and swap cache will be freed after a RCU
    grace period.  So the races are fixed via enclosing the page_mapping()
    and address_space usage in rcu_read_lock/unlock().  Some comments are
    added in code to make it clear what is protected by the RCU read lock.
    
    Link: http://lkml.kernel.org/r/20180212081227.1940-1-ying.huang@intel.com
    Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Minchan Kim <minchan@kernel.org>
    Cc: "Huang, Ying" <ying.huang@intel.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Michal Hocko <mhocko@suse.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e515a5075727362d71e7159814b085c88ee9d103
Author: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Date:   Thu Apr 5 16:25:41 2018 -0700

    mm/ksm: fix interaction with THP
    
    [ Upstream commit 77da2ba0648a4fd52e5ff97b8b2b8dd312aec4b0 ]
    
    This patch fixes a corner case for KSM.  When two pages belong or
    belonged to the same transparent hugepage, and they should be merged,
    KSM fails to split the page, and therefore no merging happens.
    
    This bug can be reproduced by:
    * making sure ksm is running (in case disabling ksmtuned)
    * enabling transparent hugepages
    * allocating a THP-aligned 1-THP-sized buffer
      e.g. on amd64: posix_memalign(&p, 1<<21, 1<<21)
    * filling it with the same values
      e.g. memset(p, 42, 1<<21)
    * performing madvise to make it mergeable
      e.g. madvise(p, 1<<21, MADV_MERGEABLE)
    * waiting for KSM to perform a few scans
    
    The expected outcome is that the all the pages get merged (1 shared and
    the rest sharing); the actual outcome is that no pages get merged (1
    unshared and the rest volatile)
    
    The reason of this behaviour is that we increase the reference count
    once for both pages we want to merge, but if they belong to the same
    hugepage (or compound page), the reference counter used in both cases is
    the one of the head of the compound page.  This means that
    split_huge_page will find a value of the reference counter too high and
    will fail.
    
    This patch solves this problem by testing if the two pages to merge
    belong to the same hugepage when attempting to merge them.  If so, the
    hugepage is split safely.  This means that the hugepage is not split if
    not necessary.
    
    Link: http://lkml.kernel.org/r/1521548069-24758-1-git-send-email-imbrenda@linux.vnet.ibm.com
    Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
    Co-authored-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Minchan Kim <minchan@kernel.org>
    Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Christian Borntraeger <borntraeger@de.ibm.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8994c254ad89ef6df289f155d22f7933d95eda69
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Wed Apr 4 12:40:07 2018 +0200

    genirq/affinity: Don't return with empty affinity masks on error
    
    [ Upstream commit 0211e12dd0a5385ecffd3557bc570dbad7fcf245 ]
    
    When the allocation of node_to_possible_cpumask fails, then
    irq_create_affinity_masks() returns with a pointer to the empty affinity
    masks array, which will cause malfunction.
    
    Reorder the allocations so the masks array allocation comes last and every
    failure path returns NULL.
    
    Fixes: 9a0ef98e186d ("genirq/affinity: Assign vectors to all present CPUs")
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Christoph Hellwig <hch@infradead.org>
    Cc: Ming Lei <ming.lei@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a658ec19a044b0702f253b9cee1e402906071007
Author: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date:   Fri Apr 6 18:37:03 2018 -0500

    ibmvnic: Zero used TX descriptor counter on reset
    
    [ Upstream commit 41f714672f93608751dbd2fa2291d476a8ff0150 ]
    
    The counter that tracks used TX descriptors pending completion
    needs to be zeroed as part of a device reset. This change fixes
    a bug causing transmit queues to be stopped unnecessarily and in
    some cases a transmit queue stall and timeout reset. If the counter
    is not reset, the remaining descriptors will not be "removed",
    effectively reducing queue capacity. If the queue is over half full,
    it will cause the queue to stall if stopped.
    
    Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0fa86ffd47a56061af3583ea79f4f3482d15819b
Author: Esben Haabendal <eha@deif.com>
Date:   Sun Apr 8 22:17:01 2018 +0200

    dp83640: Ensure against premature access to PHY registers after reset
    
    [ Upstream commit 76327a35caabd1a932e83d6a42b967aa08584e5d ]
    
    The datasheet specifies a 3uS pause after performing a software
    reset. The default implementation of genphy_soft_reset() does not
    provide this, so implement soft_reset with the needed pause.
    
    Signed-off-by: Esben Haabendal <eha@deif.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a4b1373a3ab209b501f15124238be986e750563d
Author: Sandipan Das <sandipan@linux.vnet.ibm.com>
Date:   Wed Apr 4 23:34:18 2018 +0530

    perf clang: Add support for recent clang versions
    
    [ Upstream commit 7854e499f33fd9c7e63288692ffb754d9b1d02fd ]
    
    The clang API calls used by perf have changed in recent releases and
    builds succeed with libclang-3.9 only. This introduces compatibility
    with libclang-4.0 and above.
    
    Without this patch, we will see the following compilation errors with
    libclang-4.0+:
    
     util/c++/clang.cpp: In function ‘clang::CompilerInvocation* perf::createCompilerInvocation(llvm::opt::ArgStringList, llvm::StringRef&, clang::DiagnosticsEngine&)’:
     util/c++/clang.cpp:62:33: error: ‘IK_C’ was not declared in this scope
       Opts.Inputs.emplace_back(Path, IK_C);
                                      ^~~~
     util/c++/clang.cpp: In function ‘std::unique_ptr<llvm::Module> perf::getModuleFromSource(llvm::opt::ArgStringList, llvm::StringRef, llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem>)’:
     util/c++/clang.cpp:75:26: error: no matching function for call to ‘clang::CompilerInstance::setInvocation(clang::CompilerInvocation*)’
       Clang.setInvocation(&*CI);
                               ^
     In file included from util/c++/clang.cpp:14:0:
     /usr/include/clang/Frontend/CompilerInstance.h:231:8: note: candidate: void clang::CompilerInstance::setInvocation(std::shared_ptr<clang::CompilerInvocation>)
        void setInvocation(std::shared_ptr<CompilerInvocation> Value);
             ^~~~~~~~~~~~~
    
    Committer testing:
    
    Tested on Fedora 27 after installing the clang-devel and llvm-devel
    packages, versions:
    
      # rpm -qa | egrep llvm\|clang
      llvm-5.0.1-6.fc27.x86_64
      clang-libs-5.0.1-5.fc27.x86_64
      clang-5.0.1-5.fc27.x86_64
      clang-tools-extra-5.0.1-5.fc27.x86_64
      llvm-libs-5.0.1-6.fc27.x86_64
      llvm-devel-5.0.1-6.fc27.x86_64
      clang-devel-5.0.1-5.fc27.x86_64
      #
    
    Make sure you don't have some older version lying around in /usr/local,
    etc, then:
    
      $ make LIBCLANGLLVM=1 -C tools/perf install-bin
    
    And in the end perf will be linked agains these libraries:
    
      # ldd ~/bin/perf | egrep -i llvm\|clang
            libclangAST.so.5 => /lib64/libclangAST.so.5 (0x00007f8bb2eb4000)
            libclangBasic.so.5 => /lib64/libclangBasic.so.5 (0x00007f8bb29e3000)
            libclangCodeGen.so.5 => /lib64/libclangCodeGen.so.5 (0x00007f8bb23f7000)
            libclangDriver.so.5 => /lib64/libclangDriver.so.5 (0x00007f8bb2060000)
            libclangFrontend.so.5 => /lib64/libclangFrontend.so.5 (0x00007f8bb1d06000)
            libclangLex.so.5 => /lib64/libclangLex.so.5 (0x00007f8bb1a3e000)
            libclangTooling.so.5 => /lib64/libclangTooling.so.5 (0x00007f8bb17d4000)
            libclangEdit.so.5 => /lib64/libclangEdit.so.5 (0x00007f8bb15c5000)
            libclangSema.so.5 => /lib64/libclangSema.so.5 (0x00007f8bb0cc9000)
            libclangAnalysis.so.5 => /lib64/libclangAnalysis.so.5 (0x00007f8bb0a23000)
            libclangParse.so.5 => /lib64/libclangParse.so.5 (0x00007f8bb0725000)
            libclangSerialization.so.5 => /lib64/libclangSerialization.so.5 (0x00007f8bb039a000)
            libLLVM-5.0.so => /lib64/libLLVM-5.0.so (0x00007f8bace98000)
            libclangASTMatchers.so.5 => /lib64/../lib64/libclangASTMatchers.so.5 (0x00007f8bab735000)
            libclangFormat.so.5 => /lib64/../lib64/libclangFormat.so.5 (0x00007f8bab4b2000)
            libclangRewrite.so.5 => /lib64/../lib64/libclangRewrite.so.5 (0x00007f8bab2a1000)
            libclangToolingCore.so.5 => /lib64/../lib64/libclangToolingCore.so.5 (0x00007f8bab08e000)
      #
    
    Signed-off-by: Sandipan Das <sandipan@linux.vnet.ibm.com>
    Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Fixes: 00b86691c77c ("perf clang: Add builtin clang support ant test case")
    Link: http://lkml.kernel.org/r/20180404180419.19056-2-sandipan@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7900dd9bc8bfbd775348c60432b0ff449e8ff241
Author: Sandipan Das <sandipan@linux.vnet.ibm.com>
Date:   Wed Apr 4 23:34:17 2018 +0530

    perf tools: Fix perf builds with clang support
    
    [ Upstream commit c2fb54a183cfe77c6fdc9d71e2d5299c1c302a6e ]
    
    For libclang, some distro packages provide static libraries (.a) while
    some provide shared libraries (.so). Currently, perf code can only be
    linked with static libraries. This makes perf build possible for both
    cases.
    
    Signed-off-by: Sandipan Das <sandipan@linux.vnet.ibm.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Fixes: d58ac0bf8d1e ("perf build: Add clang and llvm compile and linking support")
    Link: http://lkml.kernel.org/r/20180404180419.19056-1-sandipan@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 19c663008c8964103357d0c45d2f5f268dd9ca31
Author: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Date:   Thu Mar 29 11:53:37 2018 +0530

    powerpc/fscr: Enable interrupts earlier before calling get_user()
    
    [ Upstream commit 709b973c844c0b4d115ac3a227a2e5a68722c912 ]
    
    The function get_user() can sleep while trying to fetch instruction
    from user address space and causes the following warning from the
    scheduler.
    
    BUG: sleeping function called from invalid context
    
    Though interrupts get enabled back but it happens bit later after
    get_user() is called. This change moves enabling these interrupts
    earlier covering the function get_user(). While at this, lets check
    for kernel mode and crash as this interrupt should not have been
    triggered from the kernel context.
    
    Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ce97ce7e34aea5c94e250f02430a46d274295ce6
Author: Shunyong Yang <shunyong.yang@hxt-semitech.com>
Date:   Fri Apr 6 10:43:49 2018 +0800

    cpufreq: CPPC: Initialize shared perf capabilities of CPUs
    
    [ Upstream commit 8913315e9459b146e5888ab5138e10daa061b885 ]
    
    When multiple CPUs are related in one cpufreq policy, the first online
    CPU will be chosen by default to handle cpufreq operations. Let's take
    cpu0 and cpu1 as an example.
    
    When cpu0 is offline, policy->cpu will be shifted to cpu1. cpu1's perf
    capabilities should be initialized. Otherwise, perf capabilities are 0s
    and speed change can not take effect.
    
    This patch copies perf capabilities of the first online CPU to other
    shared CPUs when policy shared type is CPUFREQ_SHARED_TYPE_ANY.
    
    Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: Shunyong Yang <shunyong.yang@hxt-semitech.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 68f111083e8457a7493dfcee627f4ffe9498f026
Author: Carlos Maiolino <cmaiolino@redhat.com>
Date:   Tue Apr 10 22:39:04 2018 -0700

    Force log to disk before reading the AGF during a fstrim
    
    [ Upstream commit 8c81dd46ef3c416b3b95e3020fb90dbd44e6140b ]
    
    Forcing the log to disk after reading the agf is wrong, we might be
    calling xfs_log_force with XFS_LOG_SYNC with a metadata lock held.
    
    This can cause a deadlock when racing a fstrim with a filesystem
    shutdown.
    
    The deadlock has been identified due a miscalculation bug in device-mapper
    dm-thin, which returns lack of space to its users earlier than the device itself
    really runs out of space, changing the device-mapper volume into an error state.
    
    The problem happened while filling the filesystem with a single file,
    triggering the bug in device-mapper, consequently causing an IO error
    and shutting down the filesystem.
    
    If such file is removed, and fstrim executed before the XFS finishes the
    shut down process, the fstrim process will end up holding the buffer
    lock, and going to sleep on the cil wait queue.
    
    At this point, the shut down process will try to wake up all the threads
    waiting on the cil wait queue, but for this, it will try to hold the
    same buffer log already held my the fstrim, locking up the filesystem.
    
    Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
    Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3158d40c340a53a9956b29368195a011b2a0e49d
Author: Jens Axboe <axboe@kernel.dk>
Date:   Wed Apr 11 11:26:09 2018 -0600

    sr: get/drop reference to device in revalidate and check_events
    
    [ Upstream commit 2d097c50212e137e7b53ffe3b37561153eeba87d ]
    
    We can't just use scsi_cd() to get the scsi_cd structure, we have
    to grab a live reference to the device. For both callbacks, we're
    not inside an open where we already hold a reference to the device.
    
    This fixes device removal/addition under concurrent device access,
    which otherwise could result in the below oops.
    
    NULL pointer dereference at 0000000000000010
    PGD 0 P4D 0
    Oops: 0000 [#1] PREEMPT SMP
    Modules linked in:
    sr 12:0:0:0: [sr2] scsi-1 drive
     scsi_debug crc_t10dif crct10dif_generic crct10dif_common nvme nvme_core sb_edac xl
    sr 12:0:0:0: Attached scsi CD-ROM sr2
     sr_mod cdrom btrfs xor zstd_decompress zstd_compress xxhash lzo_compress zlib_defc
    sr 12:0:0:0: Attached scsi generic sg7 type 5
     igb ahci libahci i2c_algo_bit libata dca [last unloaded: crc_t10dif]
    CPU: 43 PID: 4629 Comm: systemd-udevd Not tainted 4.16.0+ #650
    Hardware name: Dell Inc. PowerEdge T630/0NT78X, BIOS 2.3.4 11/09/2016
    RIP: 0010:sr_block_revalidate_disk+0x23/0x190 [sr_mod]
    RSP: 0018:ffff883ff357bb58 EFLAGS: 00010292
    RAX: ffffffffa00b07d0 RBX: ffff883ff3058000 RCX: ffff883ff357bb66
    RDX: 0000000000000003 RSI: 0000000000007530 RDI: ffff881fea631000
    RBP: 0000000000000000 R08: ffff881fe4d38400 R09: 0000000000000000
    R10: 0000000000000000 R11: 00000000000001b6 R12: 000000000800005d
    R13: 000000000800005d R14: ffff883ffd9b3790 R15: 0000000000000000
    FS:  00007f7dc8e6d8c0(0000) GS:ffff883fff340000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000010 CR3: 0000003ffda98005 CR4: 00000000003606e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     ? __invalidate_device+0x48/0x60
     check_disk_change+0x4c/0x60
     sr_block_open+0x16/0xd0 [sr_mod]
     __blkdev_get+0xb9/0x450
     ? iget5_locked+0x1c0/0x1e0
     blkdev_get+0x11e/0x320
     ? bdget+0x11d/0x150
     ? _raw_spin_unlock+0xa/0x20
     ? bd_acquire+0xc0/0xc0
     do_dentry_open+0x1b0/0x320
     ? inode_permission+0x24/0xc0
     path_openat+0x4e6/0x1420
     ? cpumask_any_but+0x1f/0x40
     ? flush_tlb_mm_range+0xa0/0x120
     do_filp_open+0x8c/0xf0
     ? __seccomp_filter+0x28/0x230
     ? _raw_spin_unlock+0xa/0x20
     ? __handle_mm_fault+0x7d6/0x9b0
     ? list_lru_add+0xa8/0xc0
     ? _raw_spin_unlock+0xa/0x20
     ? __alloc_fd+0xaf/0x160
     ? do_sys_open+0x1a6/0x230
     do_sys_open+0x1a6/0x230
     do_syscall_64+0x5a/0x100
     entry_SYSCALL_64_after_hwframe+0x3d/0xa2
    
    Reviewed-by: Lee Duncan <lduncan@suse.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e74eb7df0ba2472ce1b699e8a0c232e079fe7d9f
Author: Xidong Wang <wangxidong_97@163.com>
Date:   Tue Apr 10 16:29:34 2018 -0700

    z3fold: fix memory leak
    
    [ Upstream commit 1ec6995d1290bfb87cc3a51f0836c889e857cef9 ]
    
    In z3fold_create_pool(), the memory allocated by __alloc_percpu() is not
    released on the error path that pool->compact_wq , which holds the
    return value of create_singlethread_workqueue(), is NULL.  This will
    result in a memory leak bug.
    
    [akpm@linux-foundation.org: fix oops on kzalloc() failure, check __alloc_percpu() retval]
    Link: http://lkml.kernel.org/r/1522803111-29209-1-git-send-email-wangxidong_97@163.com
    Signed-off-by: Xidong Wang <wangxidong_97@163.com>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: Vitaly Wool <vitalywool@gmail.com>
    Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 854299017e7577ebff2e620210912e1f2fea9859
Author: Tom Abraham <tabraham@suse.com>
Date:   Tue Apr 10 16:29:48 2018 -0700

    swap: divide-by-zero when zero length swap file on ssd
    
    [ Upstream commit a06ad633a37c64a0cd4c229fc605cee8725d376e ]
    
    Calling swapon() on a zero length swap file on SSD can lead to a
    divide-by-zero.
    
    Although creating such files isn't possible with mkswap and they woud be
    considered invalid, it would be better for the swapon code to be more
    robust and handle this condition gracefully (return -EINVAL).
    Especially since the fix is small and straightforward.
    
    To help with wear leveling on SSD, the swapon syscall calculates a
    random position in the swap file using modulo p->highest_bit, which is
    set to maxpages - 1 in read_swap_header.
    
    If the swap file is zero length, read_swap_header sets maxpages=1 and
    last_page=0, resulting in p->highest_bit=0 and we divide-by-zero when we
    modulo p->highest_bit in swapon syscall.
    
    This can be prevented by having read_swap_header return zero if
    last_page is zero.
    
    Link: http://lkml.kernel.org/r/5AC747C1020000A7001FA82C@prv-mh.provo.novell.com
    Signed-off-by: Thomas Abraham <tabraham@suse.com>
    Reported-by: <Mark.Landis@Teradata.com>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: Randy Dunlap <rdunlap@infradead.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 22a76f6399d61bbd6ba65ce0560fd2b3c665b50b
Author: Andrey Konovalov <andreyknvl@google.com>
Date:   Tue Apr 10 16:30:31 2018 -0700

    kasan, slub: fix handling of kasan_slab_free hook
    
    [ Upstream commit c3895391df385c6628638f014c87e16f5e2efd45 ]
    
    The kasan_slab_free hook's return value denotes whether the reuse of a
    slab object must be delayed (e.g.  when the object is put into memory
    qurantine).
    
    The current way SLUB handles this hook is by ignoring its return value
    and hardcoding checks similar (but not exactly the same) to the ones
    performed in kasan_slab_free, which is prone to making mistakes.
    
    The main difference between the hardcoded checks and the ones in
    kasan_slab_free is whether we want to perform a free in case when an
    invalid-free or a double-free was detected (we don't).
    
    This patch changes the way SLUB handles this by:
    1. taking into account the return value of kasan_slab_free for each of
       the objects, that are being freed;
    2. reconstructing the freelist of objects to exclude the ones, whose
       reuse must be delayed.
    
    [andreyknvl@google.com: eliminate unnecessary branch in slab_free]
      Link: http://lkml.kernel.org/r/a62759a2545fddf69b0c034547212ca1eb1b3ce2.1520359686.git.andreyknvl@google.com
    Link: http://lkml.kernel.org/r/083f58501e54731203801d899632d76175868e97.1519400992.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
    Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Pekka Enberg <penberg@kernel.org>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Kostya Serebryany <kcc@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9edc4143f24f24a71730c503e6bef9d48a056c19
Author: Andrey Konovalov <andreyknvl@google.com>
Date:   Tue Apr 10 16:30:35 2018 -0700

    kasan: fix invalid-free test crashing the kernel
    
    [ Upstream commit 91c93ed07f04f5b32a30321d522d8ca9504745bf ]
    
    When an invalid-free is triggered by one of the KASAN tests, the object
    doesn't actually get freed.  This later leads to a BUG failure in
    kmem_cache_destroy that checks that there are no allocated objects in
    the cache that is being destroyed.
    
    Fix this by calling kmem_cache_free with the proper object address after
    the call that triggers invalid-free.
    
    Link: http://lkml.kernel.org/r/286eaefc0a6c3fa9b83b87e7d6dc0fbb5b5c9926.1519924383.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
    Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Nick Terrell <terrelln@fb.com>
    Cc: Chris Mason <clm@fb.com>
    Cc: Yury Norov <ynorov@caviumnetworks.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: "Luis R . Rodriguez" <mcgrof@kernel.org>
    Cc: Palmer Dabbelt <palmer@dabbelt.com>
    Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
    Cc: Jeff Layton <jlayton@redhat.com>
    Cc: "Jason A . Donenfeld" <Jason@zx2c4.com>
    Cc: Kostya Serebryany <kcc@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ab29b0aee3ac37eb41686f09b2e68727db7bdeae
Author: Danilo Krummrich <danilokrummrich@dk-develop.de>
Date:   Tue Apr 10 16:31:38 2018 -0700

    fs/proc/proc_sysctl.c: fix potential page fault while unregistering sysctl table
    
    [ Upstream commit a0b0d1c345d0317efe594df268feb5ccc99f651e ]
    
    proc_sys_link_fill_cache() does not take currently unregistering sysctl
    tables into account, which might result into a page fault in
    sysctl_follow_link() - add a check to fix it.
    
    This bug has been present since v3.4.
    
    Link: http://lkml.kernel.org/r/20180228013506.4915-1-danilokrummrich@dk-develop.de
    Fixes: 0e47c99d7fe25 ("sysctl: Replace root_list with links between sysctl_table_sets")
    Signed-off-by: Danilo Krummrich <danilokrummrich@dk-develop.de>
    Acked-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: "Luis R . Rodriguez" <mcgrof@kernel.org>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Alexey Dobriyan <adobriyan@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e1329a2e91f8ea9e5f6a1cb84e6032df38793a1d
Author: James Smart <jsmart2021@gmail.com>
Date:   Thu Apr 12 09:16:15 2018 -0600

    nvme: expand nvmf_check_if_ready checks
    
    [ Upstream commit bb06ec31452fb2da1594f88035c2ecea4e0652f4 ]
    
    The nvmf_check_if_ready() checks that were added are very simplistic.
    As such, the routine allows a lot of cases to fail ios during windows
    of reset or re-connection. In cases where there are not multi-path
    options present, the error goes back to the callee - the filesystem
    or application. Not good.
    
    The common routine was rewritten and calling syntax slightly expanded
    so that per-transport is_ready routines don't need to be present.
    The transports now call the routine directly. The routine is now a
    fabrics routine rather than an inline function.
    
    The routine now looks at controller state to decide the action to
    take. Some states mandate io failure. Others define the condition where
    a command can be accepted.  When the decision is unclear, a generic
    queue-or-reject check is made to look for failfast or multipath ios and
    only fails the io if it is so marked. Otherwise, the io will be queued
    and wait for the controller state to resolve.
    
    Admin commands issued via ioctl share a live admin queue with commands
    from the transport for controller init. The ioctls could be intermixed
    with the initialization commands. It's possible for the ioctl cmd to
    be issued prior to the controller being enabled. To block this, the
    ioctl admin commands need to be distinguished from admin commands used
    for controller init. Added a USERCMD nvme_req(req)->rq_flags bit to
    reflect this division and set it on ioctls requests.  As the
    nvmf_check_if_ready() routine is called prior to nvme_setup_cmd(),
    ensure that commands allocated by the ioctl path (actually anything
    in core.c) preps the nvme_req(req) before starting the io. This will
    preserve the USERCMD flag during execution and/or retry.
    
    Signed-off-by: James Smart <james.smart@broadcom.com>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.e>
    Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
    Signed-off-by: Keith Busch <keith.busch@intel.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9547d168dab825ae44bf39237ac8a37f4eae8687
Author: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Date:   Wed Apr 11 11:50:15 2018 -0400

    bnxt_en: Ignore src port field in decap filter nodes
    
    [ Upstream commit 479ca3bf91da971fcefc003cf5773e8d7db24794 ]
    
    The driver currently uses src port field (along with other fields) in the
    decap tunnel key, while looking up and adding tunnel nodes. This leads to
    redundant cfa_decap_filter_alloc() requests to the FW and flow-miss in the
    flow engine. Fix this by ignoring the src port field in decap tunnel nodes.
    
    Fixes: f484f6782e01 ("bnxt_en: add hwrm FW cmds for cfa_encap_record and decap_filter")
    Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
    Signed-off-by: Michael Chan <michael.chan@broadcom.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit abf36791ffc7b3a8b5acaf667826f4f9a78420fd
Author: Dave Hansen <dave.hansen@linux.intel.com>
Date:   Fri Apr 6 13:55:14 2018 -0700

    x86/mm: Do not forbid _PAGE_RW before init for __ro_after_init
    
    [ Upstream commit 639d6aafe437a7464399d2a77d006049053df06f ]
    
    __ro_after_init data gets stuck in the .rodata section.  That's normally
    fine because the kernel itself manages the R/W properties.
    
    But, if we run __change_page_attr() on an area which is __ro_after_init,
    the .rodata checks will trigger and force the area to be immediately
    read-only, even if it is early-ish in boot.  This caused problems when
    trying to clear the _PAGE_GLOBAL bit for these area in the PTI code:
    it cleared _PAGE_GLOBAL like I asked, but also took it up on itself
    to clear _PAGE_RW.  The kernel then oopses the next time it wrote to
    a __ro_after_init data structure.
    
    To fix this, add the kernel_set_to_readonly check, just like we have
    for kernel text, just a few lines below in this function.
    
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Acked-by: Kees Cook <keescook@chromium.org>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Arjan van de Ven <arjan@linux.intel.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: David Woodhouse <dwmw2@infradead.org>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Juergen Gross <jgross@suse.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Nadav Amit <namit@vmware.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/20180406205514.8D898241@viggo.jf.intel.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a72fc5f415dc5dd4b39a4157cb41ddb591642cde
Author: Joerg Roedel <joro@8bytes.org>
Date:   Wed Apr 11 17:24:38 2018 +0200

    x86/pgtable: Don't set huge PUD/PMD on non-leaf entries
    
    [ Upstream commit e3e288121408c3abeed5af60b87b95c847143845 ]
    
    The pmd_set_huge() and pud_set_huge() functions are used from
    the generic ioremap() code to establish large mappings where this
    is possible.
    
    But the generic ioremap() code does not check whether the
    PMD/PUD entries are already populated with a non-leaf entry,
    so that any page-table pages these entries point to will be
    lost.
    
    Further, on x86-32 with SHARED_KERNEL_PMD=0, this causes a
    BUG_ON() in vmalloc_sync_one() when PMD entries are synced
    from swapper_pg_dir to the current page-table. This happens
    because the PMD entry from swapper_pg_dir was promoted to a
    huge-page entry while the current PGD still contains the
    non-leaf entry. Because both entries are present and point
    to a different page, the BUG_ON() triggers.
    
    This was actually triggered with pti-x32 enabled in a KVM
    virtual machine by the graphics driver.
    
    A real and better fix for that would be to improve the
    page-table handling in the generic ioremap() code. But that is
    out-of-scope for this patch-set and left for later work.
    
    Reported-by: David H. Gutteridge <dhgutteridge@sympatico.ca>
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: David Laight <David.Laight@aculab.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: Eduardo Valentin <eduval@amazon.com>
    Cc: Greg KH <gregkh@linuxfoundation.org>
    Cc: Jiri Kosina <jkosina@suse.cz>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Juergen Gross <jgross@suse.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Pavel Machek <pavel@ucw.cz>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Waiman Long <llong@redhat.com>
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: aliguori@amazon.com
    Cc: daniel.gruss@iaik.tugraz.at
    Cc: hughd@google.com
    Cc: keescook@google.com
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/20180411152437.GC15462@8bytes.org
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 83cb0246821715694902168b4ddc9a6ac66a7d22
Author: Filipe Manana <fdmanana@suse.com>
Date:   Thu Apr 5 22:55:12 2018 +0100

    Btrfs: fix loss of prealloc extents past i_size after fsync log replay
    
    [ Upstream commit 471d557afed155b85da237ec46c549f443eeb5de ]
    
    Currently if we allocate extents beyond an inode's i_size (through the
    fallocate system call) and then fsync the file, we log the extents but
    after a power failure we replay them and then immediately drop them.
    This behaviour happens since about 2009, commit c71bf099abdd ("Btrfs:
    Avoid orphan inodes cleanup while replaying log"), because it marks
    the inode as an orphan instead of dropping any extents beyond i_size
    before replaying logged extents, so after the log replay, and while
    the mount operation is still ongoing, we find the inode marked as an
    orphan and then perform a truncation (drop extents beyond the inode's
    i_size). Because the processing of orphan inodes is still done
    right after replaying the log and before the mount operation finishes,
    the intention of that commit does not make any sense (at least as
    of today). However reverting that behaviour is not enough, because
    we can not simply discard all extents beyond i_size and then replay
    logged extents, because we risk dropping extents beyond i_size created
    in past transactions, for example:
    
      add prealloc extent beyond i_size
      fsync - clears the flag BTRFS_INODE_NEEDS_FULL_SYNC from the inode
      transaction commit
      add another prealloc extent beyond i_size
      fsync - triggers the fast fsync path
      power failure
    
    In that scenario, we would drop the first extent and then replay the
    second one. To fix this just make sure that all prealloc extents
    beyond i_size are logged, and if we find too many (which is far from
    a common case), fallback to a full transaction commit (like we do when
    logging regular extents in the fast fsync path).
    
    Trivial reproducer:
    
     $ mkfs.btrfs -f /dev/sdb
     $ mount /dev/sdb /mnt
     $ xfs_io -f -c "pwrite -S 0xab 0 256K" /mnt/foo
     $ sync
     $ xfs_io -c "falloc -k 256K 1M" /mnt/foo
     $ xfs_io -c "fsync" /mnt/foo
     <power failure>
    
     # mount to replay log
     $ mount /dev/sdb /mnt
     # at this point the file only has one extent, at offset 0, size 256K
    
    A test case for fstests follows soon, covering multiple scenarios that
    involve adding prealloc extents with previous shrinking truncates and
    without such truncates.
    
    Fixes: c71bf099abdd ("Btrfs: Avoid orphan inodes cleanup while replaying log")
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f0119de28754e7bb469b024ff25dfc99a7f27fb8
Author: Liu Bo <bo.liu@linux.alibaba.com>
Date:   Sat Mar 31 06:11:56 2018 +0800

    Btrfs: clean up resources during umount after trans is aborted
    
    [ Upstream commit af7227338135d2f1b1552bf9a6d43e02dcba10b9 ]
    
    Currently if some fatal errors occur, like all IO get -EIO, resources
    would be cleaned up when
    a) transaction is being committed or
    b) BTRFS_FS_STATE_ERROR is set
    
    However, in some rare cases, resources may be left alone after transaction
    gets aborted and umount may run into some ASSERT(), e.g.
    ASSERT(list_empty(&block_group->dirty_list));
    
    For case a), in btrfs_commit_transaciton(), there're several places at the
    beginning where we just call btrfs_end_transaction() without cleaning up
    resources.  For case b), it is possible that the trans handle doesn't have
    any dirty stuff, then only trans hanlde is marked as aborted while
    BTRFS_FS_STATE_ERROR is not set, so resources remain in memory.
    
    This makes btrfs also check BTRFS_FS_STATE_TRANS_ABORTED to make sure that
    all resources won't stay in memory after umount.
    
    Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ea0ce813dce6353d72fbd3af2f607630d1f7f00f
Author: Johannes Thumshirn <jthumshirn@suse.de>
Date:   Thu Apr 12 09:16:06 2018 -0600

    nvme: don't send keep-alives to the discovery controller
    
    [ Upstream commit 74c6c71530847808d4e3be7b205719270efee80c ]
    
    NVMe over Fabrics 1.0 Section 5.2 "Discovery Controller Properties and
    Command Support" Figure 31 "Discovery Controller – Admin Commands"
    explicitly listst all commands but "Get Log Page" and "Identify" as
    reserved, but NetApp report the Linux host is sending Keep Alive
    commands to the discovery controller, which is a violation of the
    Spec.
    
    We're already checking for discovery controllers when configuring the
    keep alive timeout but when creating a discovery controller we're not
    hard wiring the keep alive timeout to 0 and thus remain on
    NVME_DEFAULT_KATO for the discovery controller.
    
    This can be easily remproduced when issuing a direct connect to the
    discovery susbsystem using:
    'nvme connect [...] --nqn=nqn.2014-08.org.nvmexpress.discovery'
    
    Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
    Fixes: 07bfcd09a288 ("nvme-fabrics: add a generic NVMe over Fabrics library")
    Reported-by: Martin George <marting@netapp.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Keith Busch <keith.busch@intel.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b36dc17088cf40be7d632325830199595506aa56
Author: Jean Delvare <jdelvare@suse.de>
Date:   Fri Apr 13 15:37:59 2018 +0200

    firmware: dmi_scan: Fix UUID length safety check
    
    [ Upstream commit 90fe6f8ff00a07641ca893d64f75ca22ce77cca2 ]
    
    The test which ensures that the DMI type 1 structure is long enough
    to hold the UUID is off by one. It would fail if the structure is
    exactly 24 bytes long, while that's sufficient to hold the UUID.
    
    I don't expect this bug to cause problem in practice because all
    implementations I have seen had length 8, 25 or 27 bytes, in line
    with the SMBIOS specifications. But let's fix it still.
    
    Signed-off-by: Jean Delvare <jdelvare@suse.de>
    Fixes: a814c3597a6b ("firmware: dmi_scan: Check DMI structure length")
    Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8296741f0f3c9022d8fd57c24946402722645568
Author: Rich Felker <dalias@libc.org>
Date:   Thu Mar 15 20:01:36 2018 -0400

    sh: fix debug trap failure to process signals before return to user
    
    [ Upstream commit 96a598996f6ac518ac79839ecbb17c91af91f4f7 ]
    
    When responding to a debug trap (breakpoint) in userspace, the
    kernel's trap handler raised SIGTRAP but returned from the trap via a
    code path that ignored pending signals, resulting in an infinite loop
    re-executing the trapping instruction.
    
    Signed-off-by: Rich Felker <dalias@libc.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7bb43893dc0daca1e69fd08e45dde0305dcdd3bd
Author: Pascal Roeleven <dev@pascalroeleven.nl>
Date:   Fri Apr 20 12:21:12 2018 +0200

    ARM: dts: sun4i: Fix incorrect clocks for displays
    
    commit 590b0c0cfc6162aeebbf43eaafb9753b56df1532 upstream.
    
    Some displays on sun4i devices wouldn't properly stay on unless
    'clk_ignore_unused' is used.
    
    Change the duplicate clocks to the probably intended ones.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Pascal Roeleven <dev@pascalroeleven.nl>
    Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5a69b7b69beae9bb86e7e1b095685087976cba47
Author: David Vrabel <david.vrabel@nutanix.com>
Date:   Fri May 18 16:55:46 2018 +0100

    x86/kvm: fix LAPIC timer drift when guest uses periodic mode
    
    commit d8f2f498d9ed0c5010bc1bbc1146f94c8bf9f8cc upstream.
    
    Since 4.10, commit 8003c9ae204e (KVM: LAPIC: add APIC Timer
    periodic/oneshot mode VMX preemption timer support), guests using
    periodic LAPIC timers (such as FreeBSD 8.4) would see their timers
    drift significantly over time.
    
    Differences in the underlying clocks and numerical errors means the
    periods of the two timers (hv and sw) are not the same. This
    difference will accumulate with every expiry resulting in a large
    error between the hv and sw timer.
    
    This means the sw timer may be running slow when compared to the hv
    timer. When the timer is switched from hv to sw, the now active sw
    timer will expire late. The guest VCPU is reentered and it switches to
    using the hv timer. This timer catches up, injecting multiple IRQs
    into the guest (of which the guest only sees one as it does not get to
    run until the hv timer has caught up) and thus the guest's timer rate
    is low (and becomes increasing slower over time as the sw timer lags
    further and further behind).
    
    I believe a similar problem would occur if the hv timer is the slower
    one, but I have not observed this.
    
    Fix this by synchronizing the deadlines for both timers to the same
    time source on every tick. This prevents the errors from accumulating.
    
    Fixes: 8003c9ae204e21204e49816c5ea629357e283b06
    Cc: Wanpeng Li <wanpeng.li@hotmail.com>
    Signed-off-by: David Vrabel <david.vrabel@nutanix.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: Wanpeng Li <wanpengli@tencent.com>
    Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e94a34c9e9d9aaecd093d1114c83a8e5ecddfff6
Author: Jim Mattson <jmattson@google.com>
Date:   Wed May 9 14:29:35 2018 -0700

    kvm: x86: IA32_ARCH_CAPABILITIES is always supported
    
    commit 1eaafe91a0df4157521b6417b3dd8430bf5f52f0 upstream.
    
    If there is a possibility that a VM may migrate to a Skylake host,
    then the hypervisor should report IA32_ARCH_CAPABILITIES.RSBA[bit 2]
    as being set (future work, of course). This implies that
    CPUID.(EAX=7,ECX=0):EDX.ARCH_CAPABILITIES[bit 29] should be
    set. Therefore, kvm should report this CPUID bit as being supported
    whether or not the host supports it.  Userspace is still free to clear
    the bit if it chooses.
    
    For more information on RSBA, see Intel's white paper, "Retpoline: A
    Branch Target Injection Mitigation" (Document Number 337131-001),
    currently available at https://bugzilla.kernel.org/show_bug.cgi?id=199511.
    
    Since the IA32_ARCH_CAPABILITIES MSR is emulated in kvm, there is no
    dependency on hardware support for this feature.
    
    Signed-off-by: Jim Mattson <jmattson@google.com>
    Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Fixes: 28c1c9fabf48 ("KVM/VMX: Emulate MSR_IA32_ARCH_CAPABILITIES")
    Cc: stable@vger.kernel.org
    Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5084a21bc84e3fea468549bc38f5b2dde16a1551
Author: Wei Huang <wei@redhat.com>
Date:   Tue May 1 09:49:54 2018 -0500

    KVM: x86: Update cpuid properly when CR4.OSXAVE or CR4.PKE is changed
    
    commit c4d2188206bafa177ea58e9a25b952baa0bf7712 upstream.
    
    The CPUID bits of OSXSAVE (function=0x1) and OSPKE (func=0x7, leaf=0x0)
    allows user apps to detect if OS has set CR4.OSXSAVE or CR4.PKE. KVM is
    supposed to update these CPUID bits when CR4 is updated. Current KVM
    code doesn't handle some special cases when updates come from emulator.
    Here is one example:
    
      Step 1: guest boots
      Step 2: guest OS enables XSAVE ==> CR4.OSXSAVE=1 and CPUID.OSXSAVE=1
      Step 3: guest hot reboot ==> QEMU reset CR4 to 0, but CPUID.OSXAVE==1
      Step 4: guest os checks CPUID.OSXAVE, detects 1, then executes xgetbv
    
    Step 4 above will cause an #UD and guest crash because guest OS hasn't
    turned on OSXAVE yet. This patch solves the problem by comparing the the
    old_cr4 with cr4. If the related bits have been changed,
    kvm_update_cpuid() needs to be called.
    
    Signed-off-by: Wei Huang <wei@redhat.com>
    Reviewed-by: Bandan Das <bsd@redhat.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6013d5f9990c3f721c90d50af141d596f5853002
Author: David Hildenbrand <david@redhat.com>
Date:   Wed May 9 16:12:17 2018 +0200

    KVM: s390: vsie: fix < 8k check for the itdba
    
    commit f4a551b72358facbbe5714248dff78404272feee upstream.
    
    By missing an "L", we might detect some addresses to be <8k,
    although they are not.
    
    e.g. for itdba = 100001fff
    !(gpa & ~0x1fffU) -> 1
    !(gpa & ~0x1fffUL) -> 0
    
    So we would report a SIE validity intercept although everything is fine.
    
    Fixes: 166ecb3 ("KVM: s390: vsie: support transactional execution")
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
    Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
    Reviewed-by: Cornelia Huck <cohuck@redhat.com>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
    Cc: stable@vger.kernel.org # v4.8+
    Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6bf248374172f39b763207a517c0dc4ce6f6dbb6
Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date:   Mon May 21 17:54:49 2018 -0400

    KVM/VMX: Expose SSBD properly to guests
    
    commit 0aa48468d00959c8a37cd3ac727284f4f7359151 upstream.
    
    The X86_FEATURE_SSBD is an synthetic CPU feature - that is
    it bit location has no relevance to the real CPUID 0x7.EBX[31]
    bit position. For that we need the new CPU feature name.
    
    Fixes: 52817587e706 ("x86/cpufeatures: Disentangle SSBD enumeration")
    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: kvm@vger.kernel.org
    Cc: "Radim Krčmář" <rkrcmar@redhat.com>
    Cc: stable@vger.kernel.org
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Link: https://lkml.kernel.org/r/20180521215449.26423-2-konrad.wilk@oracle.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9fa10e44b722f6773841e18912edefda735e71d8
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Tue May 22 13:02:17 2018 +0200

    PM / core: Fix direct_complete handling for devices with no callbacks
    
    commit c62ec4610c40bcc44f2d3d5ed1c312737279e2f3 upstream.
    
    Commit 08810a4119aa (PM / core: Add NEVER_SKIP and SMART_PREPARE
    driver flags) inadvertently prevented the power.direct_complete flag
    from being set for devices without PM callbacks and with disabled
    runtime PM which also prevents power.direct_complete from being set
    for their parents.  That led to problems including a resume crash on
    HP ZBook 14u.
    
    Restore the previous behavior by causing power.direct_complete to be
    set for those devices again, but do that in a more direct way to
    avoid overlooking that case in the future.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=199693
    Fixes: 08810a4119aa (PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags)
    Reported-by: Thomas Martitz <kugel@rockbox.org>
    Tested-by: Thomas Martitz <kugel@rockbox.org>
    Cc: 4.15+ <stable@vger.kernel.org> # 4.15+
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
    Reviewed-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2ee0fd5036603f8c1383a3a68b3a1db0437621d2
Author: Gustavo A. R. Silva <gustavo@embeddedor.com>
Date:   Fri May 25 14:47:57 2018 -0700

    kernel/sys.c: fix potential Spectre v1 issue
    
    commit 23d6aef74da86a33fa6bb75f79565e0a16ee97c2 upstream.
    
    `resource' can be controlled by user-space, hence leading to a potential
    exploitation of the Spectre variant 1 vulnerability.
    
    This issue was detected with the help of Smatch:
    
      kernel/sys.c:1474 __do_compat_sys_old_getrlimit() warn: potential spectre issue 'get_current()->signal->rlim' (local cap)
      kernel/sys.c:1455 __do_sys_old_getrlimit() warn: potential spectre issue 'get_current()->signal->rlim' (local cap)
    
    Fix this by sanitizing *resource* before using it to index
    current->signal->rlim
    
    Notice that given that speculation windows are large, the policy is to
    kill the speculation on the first load and not worry if it can be
    completed with a dependent load/store [1].
    
    [1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2
    
    Link: http://lkml.kernel.org/r/20180515030038.GA11822@embeddedor.com
    Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: Alexei Starovoitov <ast@kernel.org>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a27c438f29301e60e07e252dabf12376c50bda85
Author: David Hildenbrand <david@redhat.com>
Date:   Fri May 25 14:48:11 2018 -0700

    kasan: fix memory hotplug during boot
    
    commit 3f1959721558a976aaf9c2024d5bc884e6411bf7 upstream.
    
    Using module_init() is wrong.  E.g.  ACPI adds and onlines memory before
    our memory notifier gets registered.
    
    This makes sure that ACPI memory detected during boot up will not result
    in a kernel crash.
    
    Easily reproducible with QEMU, just specify a DIMM when starting up.
    
    Link: http://lkml.kernel.org/r/20180522100756.18478-3-david@redhat.com
    Fixes: 786a8959912e ("kasan: disable memory hotplug")
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 33dbfdb5cda4f36985573d373899ae08d86dbbd5
Author: David Hildenbrand <david@redhat.com>
Date:   Fri May 25 14:48:08 2018 -0700

    kasan: free allocated shadow memory on MEM_CANCEL_ONLINE
    
    commit ed1596f9ab958dd156a66c9ff1029d3761c1786a upstream.
    
    We have to free memory again when we cancel onlining, otherwise a later
    onlining attempt will fail.
    
    Link: http://lkml.kernel.org/r/20180522100756.18478-2-david@redhat.com
    Fixes: fa69b5989bb0 ("mm/kasan: add support for memory hotplug")
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fbc7652f73de00025c516494718901370cc24820
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Fri May 25 14:47:38 2018 -0700

    mm/kasan: don't vfree() nonexistent vm_area
    
    commit 0f901dcbc31f88ae41a2aaa365f7802b5d520a28 upstream.
    
    KASAN uses different routines to map shadow for hot added memory and
    memory obtained in boot process.  Attempt to offline memory onlined by
    normal boot process leads to this:
    
        Trying to vfree() nonexistent vm area (000000005d3b34b9)
        WARNING: CPU: 2 PID: 13215 at mm/vmalloc.c:1525 __vunmap+0x147/0x190
    
        Call Trace:
         kasan_mem_notifier+0xad/0xb9
         notifier_call_chain+0x166/0x260
         __blocking_notifier_call_chain+0xdb/0x140
         __offline_pages+0x96a/0xb10
         memory_subsys_offline+0x76/0xc0
         device_offline+0xb8/0x120
         store_mem_state+0xfa/0x120
         kernfs_fop_write+0x1d5/0x320
         __vfs_write+0xd4/0x530
         vfs_write+0x105/0x340
         SyS_write+0xb0/0x140
    
    Obviously we can't call vfree() to free memory that wasn't allocated via
    vmalloc().  Use find_vm_area() to see if we can call vfree().
    
    Unfortunately it's a bit tricky to properly unmap and free shadow
    allocated during boot, so we'll have to keep it.  If memory will come
    online again that shadow will be reused.
    
    Matthew asked: how can you call vfree() on something that isn't a
    vmalloc address?
    
      vfree() is able to free any address returned by
      __vmalloc_node_range().  And __vmalloc_node_range() gives you any
      address you ask.  It doesn't have to be an address in [VMALLOC_START,
      VMALLOC_END] range.
    
      That's also how the module_alloc()/module_memfree() works on
      architectures that have designated area for modules.
    
    [aryabinin@virtuozzo.com: improve comments]
      Link: http://lkml.kernel.org/r/dabee6ab-3a7a-51cd-3b86-5468718e0390@virtuozzo.com
    [akpm@linux-foundation.org: fix typos, reflow comment]
    Link: http://lkml.kernel.org/r/20180201163349.8700-1-aryabinin@virtuozzo.com
    Fixes: fa69b5989bb0 ("mm/kasan: add support for memory hotplug")
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Reported-by: Paul Menzel <pmenzel+linux-kasan-dev@molgen.mpg.de>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 246e52a47b6ac081e9830f532ac83b0d958a530c
Author: Davidlohr Bueso <dave@stgolabs.net>
Date:   Fri May 25 14:47:30 2018 -0700

    ipc/shm: fix shmat() nil address after round-down when remapping
    
    commit 8f89c007b6dec16a1793cb88de88fcc02117bbbc upstream.
    
    shmat()'s SHM_REMAP option forbids passing a nil address for; this is in
    fact the very first thing we check for.  Andrea reported that for
    SHM_RND|SHM_REMAP cases we can end up bypassing the initial addr check,
    but we need to check again if the address was rounded down to nil.  As
    of this patch, such cases will return -EINVAL.
    
    Link: http://lkml.kernel.org/r/20180503204934.kk63josdu6u53fbd@linux-n805
    Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
    Reported-by: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Joe Lawrence <joe.lawrence@redhat.com>
    Cc: Manfred Spraul <manfred@colorfullife.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fe05c7ada1d68b98726edcdca4d41f548099b2c5
Author: Davidlohr Bueso <dave@stgolabs.net>
Date:   Fri May 25 14:47:27 2018 -0700

    Revert "ipc/shm: Fix shmat mmap nil-page protection"
    
    commit a73ab244f0dad8fffb3291b905f73e2d3eaa7c00 upstream.
    
    Patch series "ipc/shm: shmat() fixes around nil-page".
    
    These patches fix two issues reported[1] a while back by Joe and Andrea
    around how shmat(2) behaves with nil-page.
    
    The first reverts a commit that it was incorrectly thought that mapping
    nil-page (address=0) was a no no with MAP_FIXED.  This is not the case,
    with the exception of SHM_REMAP; which is address in the second patch.
    
    I chose two patches because it is easier to backport and it explicitly
    reverts bogus behaviour.  Both patches ought to be in -stable and ltp
    testcases need updated (the added testcase around the cve can be
    modified to just test for SHM_RND|SHM_REMAP).
    
    [1] lkml.kernel.org/r/20180430172152.nfa564pvgpk3ut7p@linux-n805
    
    This patch (of 2):
    
    Commit 95e91b831f87 ("ipc/shm: Fix shmat mmap nil-page protection")
    worked on the idea that we should not be mapping as root addr=0 and
    MAP_FIXED.  However, it was reported that this scenario is in fact
    valid, thus making the patch both bogus and breaks userspace as well.
    
    For example X11's libint10.so relies on shmat(1, SHM_RND) for lowmem
    initialization[1].
    
    [1] https://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/os-support/linux/int10/linux.c#n347
    Link: http://lkml.kernel.org/r/20180503203243.15045-2-dave@stgolabs.net
    Fixes: 95e91b831f87 ("ipc/shm: Fix shmat mmap nil-page protection")
    Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
    Reported-by: Joe Lawrence <joe.lawrence@redhat.com>
    Reported-by: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Manfred Spraul <manfred@colorfullife.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 386f7bd21738371168a464fd0f45651817760a95
Author: Matthew Wilcox <mawilcox@microsoft.com>
Date:   Fri May 25 14:47:24 2018 -0700

    idr: fix invalid ptr dereference on item delete
    
    commit 7a4deea1aa8bddfed4ef1b35fc2b6732563d8ad5 upstream.
    
    If the radix tree underlying the IDR happens to be full and we attempt
    to remove an id which is larger than any id in the IDR, we will call
    __radix_tree_delete() with an uninitialised 'slot' pointer, at which
    point anything could happen.  This was easiest to hit with a single
    entry at id 0 and attempting to remove a non-0 id, but it could have
    happened with 64 entries and attempting to remove an id >= 64.
    
    Roman said:
    
      The syzcaller test boils down to opening /dev/kvm, creating an
      eventfd, and calling a couple of KVM ioctls. None of this requires
      superuser. And the result is dereferencing an uninitialized pointer
      which is likely a crash. The specific path caught by syzbot is via
      KVM_HYPERV_EVENTD ioctl which is new in 4.17. But I guess there are
      other user-triggerable paths, so cc:stable is probably justified.
    
    Matthew added:
    
      We have around 250 calls to idr_remove() in the kernel today. Many of
      them pass an ID which is embedded in the object they're removing, so
      they're safe. Picking a few likely candidates:
    
      drivers/firewire/core-cdev.c looks unsafe; the ID comes from an ioctl.
      drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c is similar
      drivers/atm/nicstar.c could be taken down by a handcrafted packet
    
    Link: http://lkml.kernel.org/r/20180518175025.GD6361@bombadil.infradead.org
    Fixes: 0a835c4f090a ("Reimplement IDR and IDA using the radix tree")
    Reported-by: <syzbot+35666cba7f0a337e2e79@syzkaller.appspotmail.com>
    Debugged-by: Roman Kagan <rkagan@virtuozzo.com>
    Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b0ea08e1bd67af984e4de51f05c973528cd0f7fb
Author: Rafał Miłecki <rafal@milecki.pl>
Date:   Tue May 8 11:31:04 2018 +0200

    bcma: fix buffer size caused crash in bcma_core_mips_print_irq()
    
    commit 361de091a4b97aa9081d304d742f80d486ab7125 upstream.
    
    Used buffer wasn't big enough to hold whole strings. Example output of
    this function is:
    [    0.180892] bcma: bus0: core 0x0800, irq: 2(S)* 3  4  5  6  D  I
    [    0.180948] bcma: bus0: core 0x0812, irq: 2(S)  3* 4  5  6  D  I
    [    0.180998] bcma: bus0: core 0x082d, irq: 2(S)  3  4* 5  6  D  I
    [    0.181046] bcma: bus0: core 0x082c, irq: 2(S)  3  4  5  6  D  I*
    which means we need to store up to 24 chars.
    
    Fixes: 758f7e06063a8 ("bcma: Use bcma_debug and not pr_cont in MIPS driver")
    Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
    Cc: stable@vger.kernel.org # v4.15+
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 98d02fd4618c48d75589820e8fc39e60c3d3728e
Author: Jens Axboe <axboe@kernel.dk>
Date:   Mon May 21 12:21:14 2018 -0600

    sr: pass down correctly sized SCSI sense buffer
    
    commit f7068114d45ec55996b9040e98111afa56e010fe upstream.
    
    We're casting the CDROM layer request_sense to the SCSI sense
    buffer, but the former is 64 bytes and the latter is 96 bytes.
    As we generally allocate these on the stack, we end up blowing
    up the stack.
    
    Fix this by wrapping the scsi_execute() call with a properly
    sized sense buffer, and copying back the bits for the CDROM
    layer.
    
    Cc: stable@vger.kernel.org
    Reported-by: Piotr Gabriel Kosinski <pg.kosinski@gmail.com>
    Reported-by: Daniel Shapira <daniel@twistlock.com>
    Tested-by: Kees Cook <keescook@chromium.org>
    Fixes: 82ed4db499b8 ("block: split scsi_request out of struct request")
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 156677d98e6ee0f8cc44cd15e209ac54329cd7c2
Author: Lidong Chen <jemmy858585@gmail.com>
Date:   Tue May 8 16:50:16 2018 +0800

    IB/umem: Use the correct mm during ib_umem_release
    
    commit 8e907ed4882714fd13cfe670681fc6cb5284c780 upstream.
    
    User-space may invoke ibv_reg_mr and ibv_dereg_mr in different threads.
    
    If ibv_dereg_mr is called after the thread which invoked ibv_reg_mr has
    exited, get_pid_task will return NULL and ib_umem_release will not
    decrease mm->pinned_vm.
    
    Instead of using threads to locate the mm, use the overall tgid from the
    ib_ucontext struct instead. This matches the behavior of ODP and
    disassociate in handling the mm of the process that called ibv_reg_mr.
    
    Cc: <stable@vger.kernel.org>
    Fixes: 87773dd56d54 ("IB: ib_umem_release() should decrement mm->pinned_vm from ib_umem_get")
    Signed-off-by: Lidong Chen <lidongchen@tencent.com>
    Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 062ac5a18a1b05905abdb6c7b602c855b28b5674
Author: Michael J. Ruhl <michael.j.ruhl@intel.com>
Date:   Wed May 2 06:42:51 2018 -0700

    IB/hfi1: Use after free race condition in send context error path
    
    commit f9e76ca3771bf23d2142a81a88ddd8f31f5c4c03 upstream.
    
    A pio send egress error can occur when the PSM library attempts to
    to send a bad packet.  That issue is still being investigated.
    
    The pio error interrupt handler then attempts to progress the recovery
    of the errored pio send context.
    
    Code inspection reveals that the handling lacks the necessary locking
    if that recovery interleaves with a PSM close of the "context" object
    contains the pio send context.
    
    The lack of the locking can cause the recovery to access the already
    freed pio send context object and incorrectly deduce that the pio
    send context is actually a kernel pio send context as shown by the
    NULL deref stack below:
    
    [<ffffffff8143d78c>] _dev_info+0x6c/0x90
    [<ffffffffc0613230>] sc_restart+0x70/0x1f0 [hfi1]
    [<ffffffff816ab124>] ? __schedule+0x424/0x9b0
    [<ffffffffc06133c5>] sc_halted+0x15/0x20 [hfi1]
    [<ffffffff810aa3ba>] process_one_work+0x17a/0x440
    [<ffffffff810ab086>] worker_thread+0x126/0x3c0
    [<ffffffff810aaf60>] ? manage_workers.isra.24+0x2a0/0x2a0
    [<ffffffff810b252f>] kthread+0xcf/0xe0
    [<ffffffff810b2460>] ? insert_kthread_work+0x40/0x40
    [<ffffffff816b8798>] ret_from_fork+0x58/0x90
    [<ffffffff810b2460>] ? insert_kthread_work+0x40/0x40
    
    This is the best case scenario and other scenarios can corrupt the
    already freed memory.
    
    Fix by adding the necessary locking in the pio send context error
    handler.
    
    Cc: <stable@vger.kernel.org> # 4.9.x
    Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
    Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
    Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
    Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b9dfa40cc0100766270fe8f985ae06405da8fbd7
Author: Michael Neuling <mikey@neuling.org>
Date:   Fri May 18 11:37:42 2018 +1000

    powerpc/64s: Clear PCR on boot
    
    commit faf37c44a105f3608115785f17cbbf3500f8bc71 upstream.
    
    Clear the PCR (Processor Compatibility Register) on boot to ensure we
    are not running in a compatibility mode.
    
    We've seen this cause problems when a crash (and kdump) occurs while
    running compat mode guests. The kdump kernel then runs with the PCR
    set and causes problems. The symptom in the kdump kernel (also seen in
    petitboot after fast-reboot) is early userspace programs taking
    sigills on newer instructions (seen in libc).
    
    Signed-off-by: Michael Neuling <mikey@neuling.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 61ee78b99f544e2ed77789da94eca527a221a239
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Sat Apr 28 00:42:52 2018 +0200

    arm64: export tishift functions to modules
    
    commit 255845fc43a3aaf806852a1d3bc89bff1411ebe3 upstream.
    
    Otherwise modules that use these arithmetic operations will fail to
    link. We accomplish this with the usual EXPORT_SYMBOL, which on most
    architectures goes in the .S file but the ARM64 maintainers prefer that
    insead it goes into arm64ksyms.
    
    While we're at it, we also fix this up to use SPDX, and I personally
    choose to relicense this as GPL2||BSD so that these symbols don't need
    to be export_symbol_gpl, so all modules can use the routines, since
    these are important general purpose compiler-generated function calls.
    
    Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
    Reported-by: PaX Team <pageexec@freemail.hu>
    Cc: stable@vger.kernel.org
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7a5c78b05ec6de5cddc2f8d3308e722ec4e4e280
Author: Will Deacon <will.deacon@arm.com>
Date:   Mon May 21 17:44:57 2018 +0100

    arm64: lse: Add early clobbers to some input/output asm operands
    
    commit 32c3fa7cdf0c4a3eb8405fc3e13398de019e828b upstream.
    
    For LSE atomics that read and write a register operand, we need to
    ensure that these operands are annotated as "early clobber" if the
    register is written before all of the input operands have been consumed.
    Failure to do so can result in the compiler allocating the same register
    to both operands, leading to splats such as:
    
     Unable to handle kernel paging request at virtual address 11111122222221
     [...]
     x1 : 1111111122222222 x0 : 1111111122222221
     Process swapper/0 (pid: 1, stack limit = 0x000000008209f908)
     Call trace:
      test_atomic64+0x1360/0x155c
    
    where x0 has been allocated as both the value to be stored and also the
    atomic_t pointer.
    
    This patch adds the missing clobbers.
    
    Cc: <stable@vger.kernel.org>
    Cc: Dave Martin <dave.martin@arm.com>
    Cc: Robin Murphy <robin.murphy@arm.com>
    Reported-by: Mark Salter <msalter@redhat.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7a42da880f700c3f80f917ee4d355bc4b5b6cb15
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Wed May 23 16:11:24 2018 +0200

    drm/vmwgfx: Fix 32-bit VMW_PORT_HB_[IN|OUT] macros
    
    commit 938ae7259c908ad031da35d551da297640bb640c upstream.
    
    Depending on whether the kernel is compiled with frame-pointer or not,
    the temporary memory location used for the bp parameter in these macros
    is referenced relative to the stack pointer or the frame pointer.
    Hence we can never reference that parameter when we've modified either
    the stack pointer or the frame pointer, because then the compiler would
    generate an incorrect stack reference.
    
    Fix this by pushing the temporary memory parameter on a known location on
    the stack before modifying the stack- and frame pointers.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    Reviewed-by: Sinclair Yeh <syeh@vmware.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 76edcd337360791a3baa9552bcecf2721253cb34
Author: Joe Jin <joe.jin@oracle.com>
Date:   Thu May 17 12:33:28 2018 -0700

    xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
    
    commit 4855c92dbb7b3b85c23e88ab7ca04f99b9677b41 upstream.
    
    When run raidconfig from Dom0 we found that the Xen DMA heap is reduced,
    but Dom Heap is increased by the same size. Tracing raidconfig we found
    that the related ioctl() in megaraid_sas will call dma_alloc_coherent()
    to apply memory. If the memory allocated by Dom0 is not in the DMA area,
    it will exchange memory with Xen to meet the requiment. Later drivers
    call dma_free_coherent() to free the memory, on xen_swiotlb_free_coherent()
    the check condition (dev_addr + size - 1 <= dma_mask) is always false,
    it prevents calling xen_destroy_contiguous_region() to return the memory
    to the Xen DMA heap.
    
    This issue introduced by commit 6810df88dcfc2 "xen-swiotlb: When doing
    coherent alloc/dealloc check before swizzling the MFNs.".
    
    Signed-off-by: Joe Jin <joe.jin@oracle.com>
    Tested-by: John Sobecki <john.sobecki@oracle.com>
    Reviewed-by: Rzeszutek Wilk <konrad.wilk@oracle.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b30247e03bc0499b9c150beed53cc0dbcf47b840
Author: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Date:   Sat May 19 22:29:36 2018 +0100

    libata: blacklist Micron 500IT SSD with MU01 firmware
    
    commit 136d769e0b3475d71350aa3648a116a6ee7a8f6c upstream.
    
    While whitelisting Micron M500DC drives, the tweaked blacklist entry
    enabled queued TRIM from M500IT variants also. But these do not support
    queued TRIM. And while using those SSDs with the latest kernel we have
    seen errors and even the partition table getting corrupted.
    
    Some part from the dmesg:
    [    6.727384] ata1.00: ATA-9: Micron_M500IT_MTFDDAK060MBD, MU01, max UDMA/133
    [    6.727390] ata1.00: 117231408 sectors, multi 16: LBA48 NCQ (depth 31/32), AA
    [    6.741026] ata1.00: supports DRM functions and may not be fully accessible
    [    6.759887] ata1.00: configured for UDMA/133
    [    6.762256] scsi 0:0:0:0: Direct-Access     ATA      Micron_M500IT_MT MU01 PQ: 0 ANSI: 5
    
    and then for the error:
    [  120.860334] ata1.00: exception Emask 0x1 SAct 0x7ffc0007 SErr 0x0 action 0x6 frozen
    [  120.860338] ata1.00: irq_stat 0x40000008
    [  120.860342] ata1.00: failed command: SEND FPDMA QUEUED
    [  120.860351] ata1.00: cmd 64/01:00:00:00:00/00:00:00:00:00/a0 tag 0 ncq dma 512 out
             res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x5 (timeout)
    [  120.860353] ata1.00: status: { DRDY }
    [  120.860543] ata1: hard resetting link
    [  121.166128] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
    [  121.166376] ata1.00: supports DRM functions and may not be fully accessible
    [  121.186238] ata1.00: supports DRM functions and may not be fully accessible
    [  121.204445] ata1.00: configured for UDMA/133
    [  121.204454] ata1.00: device reported invalid CHS sector 0
    [  121.204541] sd 0:0:0:0: [sda] tag#18 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08
    [  121.204546] sd 0:0:0:0: [sda] tag#18 Sense Key : 0x5 [current]
    [  121.204550] sd 0:0:0:0: [sda] tag#18 ASC=0x21 ASCQ=0x4
    [  121.204555] sd 0:0:0:0: [sda] tag#18 CDB: opcode=0x93 93 08 00 00 00 00 00 04 28 80 00 00 00 30 00 00
    [  121.204559] print_req_error: I/O error, dev sda, sector 272512
    
    After few reboots with these errors, and the SSD is corrupted.
    After blacklisting it, the errors are not seen and the SSD does not get
    corrupted any more.
    
    Fixes: 243918be6393 ("libata: Do not blacklist Micron M500DC")
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b00fbdf10977585b30a223d1106b3d3ecef6a1a0
Author: Tejun Heo <tj@kernel.org>
Date:   Tue May 8 14:21:56 2018 -0700

    libata: Blacklist some Sandisk SSDs for NCQ
    
    commit 322579dcc865b94b47345ad1b6002ad167f85405 upstream.
    
    Sandisk SSDs SD7SN6S256G and SD8SN8U256G are regularly locking up
    regularly under sustained moderate load with NCQ enabled.  Blacklist
    for now.
    
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Reported-by: Dave Jones <davej@codemonkey.org.uk>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e93124728d452c93589b83bb0e99f1f794269f60
Author: Mika Westerberg <mika.westerberg@linux.intel.com>
Date:   Thu May 24 11:12:16 2018 +0300

    ahci: Add PCI ID for Cannon Lake PCH-LP AHCI
    
    commit 4544e403eb25552aed7f0ee181a7a506b8800403 upstream.
    
    This one should be using the default LPM policy for mobile chipsets so
    add the PCI ID to the driver list of supported revices.
    
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 899fb543aafc2191a4b1a03b03c8902746634655
Author: Corneliu Doban <corneliu.doban@broadcom.com>
Date:   Fri May 18 15:03:57 2018 -0700

    mmc: sdhci-iproc: add SDHCI_QUIRK2_HOST_OFF_CARD_ON for cygnus
    
    commit 3de06d5a1f05c11c94cbb68af14dbfa7fb81d78b upstream.
    
    The SDHCI_QUIRK2_HOST_OFF_CARD_ON is needed for the driver to
    properly reset the host controller (reset all) on initialization
    after exiting deep sleep.
    
    Signed-off-by: Corneliu Doban <corneliu.doban@broadcom.com>
    Signed-off-by: Scott Branden <scott.branden@broadcom.com>
    Reviewed-by: Ray Jui <ray.jui@broadcom.com>
    Reviewed-by: Srinath Mannam <srinath.mannam@broadcom.com>
    Fixes: c833e92bbb60 ("mmc: sdhci-iproc: support standard byte register accesses")
    Cc: stable@vger.kernel.org # v4.10+
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5e81497539c6f77c060892a800afbe9578b37329
Author: Corneliu Doban <corneliu.doban@broadcom.com>
Date:   Fri May 18 15:03:56 2018 -0700

    mmc: sdhci-iproc: fix 32bit writes for TRANSFER_MODE register
    
    commit 5f651b870485ee60f5abbbd85195a6852978894a upstream.
    
    When the host controller accepts only 32bit writes, the value of the
    16bit TRANSFER_MODE register, that has the same 32bit address as the
    16bit COMMAND register, needs to be saved and it will be written
    in a 32bit write together with the command as this will trigger the
    host to send the command on the SD interface.
    When sending the tuning command, TRANSFER_MODE is written and then
    sdhci_set_transfer_mode reads it back to clear AUTO_CMD12 bit and
    write it again resulting in wrong value to be written because the
    initial write value was saved in a shadow and the read-back returned
    a wrong value, from the register.
    Fix sdhci_iproc_readw to return the saved value of TRANSFER_MODE
    when a saved value exist.
    Same fix for read of BLOCK_SIZE and BLOCK_COUNT registers, that are
    saved for a different reason, although a scenario that will cause the
    mentioned problem on this registers is not probable.
    
    Fixes: b580c52d58d9 ("mmc: sdhci-iproc: add IPROC SDHCI driver")
    Signed-off-by: Corneliu Doban <corneliu.doban@broadcom.com>
    Signed-off-by: Scott Branden <scott.branden@broadcom.com>
    Cc: stable@vger.kernel.org # v4.1+
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 38b6eea7b99335e11ba8cf7370a93eb35ed457b0
Author: Srinath Mannam <srinath.mannam@broadcom.com>
Date:   Fri May 18 15:03:55 2018 -0700

    mmc: sdhci-iproc: remove hard coded mmc cap 1.8v
    
    commit 4c94238f37af87a2165c3fb491b4a8b50e90649c upstream.
    
    Remove hard coded mmc cap 1.8v from platform data as it is board specific.
    The 1.8v DDR mmc caps can be enabled using DTS property for those
    boards that support it.
    
    Fixes: b17b4ab8ce38 ("mmc: sdhci-iproc: define MMC caps in platform data")
    Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
    Signed-off-by: Scott Branden <scott.branden@broadcom.com>
    Reviewed-by: Ray Jui <ray.jui@broadcom.com>
    Cc: stable@vger.kernel.org # v4.8+
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 09f4e5a16b6f9fb4824bcf2b0f09b83e8404c6c0
Author: Mathieu Malaterre <malat@debian.org>
Date:   Wed May 16 21:20:20 2018 +0200

    mmc: block: propagate correct returned value in mmc_rpmb_ioctl
    
    commit b25b750df99bcba29317d3f9d9f93c4ec58890e6 upstream.
    
    In commit 97548575bef3 ("mmc: block: Convert RPMB to a character device") a
    new function `mmc_rpmb_ioctl` was added. The final return is simply
    returning a value of `0` instead of propagating the correct return code.
    
    Discovered during a compilation with W=1, silence the following gcc warning
    
    drivers/mmc/core/block.c:2470:6: warning: variable ‘ret’ set but not used
    [-Wunused-but-set-variable]
    
    Signed-off-by: Mathieu Malaterre <malat@debian.org>
    Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
    Fixes: 97548575bef3 ("mmc: block: Convert RPMB to a character device")
    Cc: stable@vger.kernel.org # v4.15+
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b6824a2008b3fe432cff9252619fa22de3d93c23
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Fri May 4 08:23:01 2018 -0400

    do d_instantiate/unlock_new_inode combinations safely
    
    commit 1e2e547a93a00ebc21582c06ca3c6cfea2a309ee upstream.
    
    For anything NFS-exported we do _not_ want to unlock new inode
    before it has grown an alias; original set of fixes got the
    ordering right, but missed the nasty complication in case of
    lockdep being enabled - unlock_new_inode() does
            lockdep_annotate_inode_mutex_key(inode)
    which can only be done before anyone gets a chance to touch
    ->i_mutex.  Unfortunately, flipping the order and doing
    unlock_new_inode() before d_instantiate() opens a window when
    mkdir can race with open-by-fhandle on a guessed fhandle, leading
    to multiple aliases for a directory inode and all the breakage
    that follows from that.
    
            Correct solution: a new primitive (d_instantiate_new())
    combining these two in the right order - lockdep annotate, then
    d_instantiate(), then the rest of unlock_new_inode().  All
    combinations of d_instantiate() with unlock_new_inode() should
    be converted to that.
    
    Cc: stable@kernel.org   # 2.6.29 and later
    Tested-by: Mike Marshall <hubcap@omnibond.com>
    Reviewed-by: Andreas Dilger <adilger@dilger.ca>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b29b67147cb5187ac735e1b88c169cf4ea8b52c5
Author: Ben Hutchings <ben.hutchings@codethink.co.uk>
Date:   Thu May 17 22:34:39 2018 +0100

    ALSA: timer: Fix pause event notification
    
    commit 3ae180972564846e6d794e3615e1ab0a1e6c4ef9 upstream.
    
    Commit f65e0d299807 ("ALSA: timer: Call notifier in the same spinlock")
    combined the start/continue and stop/pause functions, and in doing so
    changed the event code for the pause case to SNDRV_TIMER_EVENT_CONTINUE.
    Change it back to SNDRV_TIMER_EVENT_PAUSE.
    
    Fixes: f65e0d299807 ("ALSA: timer: Call notifier in the same spinlock")
    Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
    Cc: stable@vger.kernel.org
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 35118a8ff8f4fd5ec9caffa2998adea95ca82589
Author: Omar Sandoval <osandov@fb.com>
Date:   Tue May 22 09:47:58 2018 -0700

    Btrfs: fix error handling in btrfs_truncate()
    
    commit d50147381aa0c9725d63a677c138c47f55d6d3bc upstream.
    
    Jun Wu at Facebook reported that an internal service was seeing a return
    value of 1 from ftruncate() on Btrfs in some cases. This is coming from
    the NEED_TRUNCATE_BLOCK return value from btrfs_truncate_inode_items().
    
    btrfs_truncate() uses two variables for error handling, ret and err.
    When btrfs_truncate_inode_items() returns non-zero, we set err to the
    return value. However, NEED_TRUNCATE_BLOCK is not an error. Make sure we
    only set err if ret is an error (i.e., negative).
    
    To reproduce the issue: mount a filesystem with -o compress-force=zstd
    and the following program will encounter return value of 1 from
    ftruncate:
    
    int main(void) {
            char buf[256] = { 0 };
            int ret;
            int fd;
    
            fd = open("test", O_CREAT | O_WRONLY | O_TRUNC, 0666);
            if (fd == -1) {
                    perror("open");
                    return EXIT_FAILURE;
            }
    
            if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
                    perror("write");
                    close(fd);
                    return EXIT_FAILURE;
            }
    
            if (fsync(fd) == -1) {
                    perror("fsync");
                    close(fd);
                    return EXIT_FAILURE;
            }
    
            ret = ftruncate(fd, 128);
            if (ret) {
                    printf("ftruncate() returned %d\n", ret);
                    close(fd);
                    return EXIT_FAILURE;
            }
    
            close(fd);
            return EXIT_SUCCESS;
    }
    
    Fixes: ddfae63cc8e0 ("btrfs: move btrfs_truncate_block out of trans handle")
    CC: stable@vger.kernel.org # 4.15+
    Reported-by: Jun Wu <quark@fb.com>
    Signed-off-by: Omar Sandoval <osandov@fb.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7872045c3cd100b25a834effe2f0e0abb4aed54f
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Sun May 20 16:46:23 2018 -0400

    aio: fix io_destroy(2) vs. lookup_ioctx() race
    
    commit baf10564fbb66ea222cae66fbff11c444590ffd9 upstream.
    
    kill_ioctx() used to have an explicit RCU delay between removing the
    reference from ->ioctx_table and percpu_ref_kill() dropping the refcount.
    At some point that delay had been removed, on the theory that
    percpu_ref_kill() itself contained an RCU delay.  Unfortunately, that was
    the wrong kind of RCU delay and it didn't care about rcu_read_lock() used
    by lookup_ioctx().  As the result, we could get ctx freed right under
    lookup_ioctx().  Tejun has fixed that in a6d7cff472e ("fs/aio: Add explicit
    RCU grace period when freeing kioctx"); however, that fix is not enough.
    
    Suppose io_destroy() from one thread races with e.g. io_setup() from another;
    CPU1 removes the reference from current->mm->ioctx_table[...] just as CPU2
    has picked it (under rcu_read_lock()).  Then CPU1 proceeds to drop the
    refcount, getting it to 0 and triggering a call of free_ioctx_users(),
    which proceeds to drop the secondary refcount and once that reaches zero
    calls free_ioctx_reqs().  That does
            INIT_RCU_WORK(&ctx->free_rwork, free_ioctx);
            queue_rcu_work(system_wq, &ctx->free_rwork);
    and schedules freeing the whole thing after RCU delay.
    
    In the meanwhile CPU2 has gotten around to percpu_ref_get(), bumping the
    refcount from 0 to 1 and returned the reference to io_setup().
    
    Tejun's fix (that queue_rcu_work() in there) guarantees that ctx won't get
    freed until after percpu_ref_get().  Sure, we'd increment the counter before
    ctx can be freed.  Now we are out of rcu_read_lock() and there's nothing to
    stop freeing of the whole thing.  Unfortunately, CPU2 assumes that since it
    has grabbed the reference, ctx is *NOT* going away until it gets around to
    dropping that reference.
    
    The fix is obvious - use percpu_ref_tryget_live() and treat failure as miss.
    It's not costlier than what we currently do in normal case, it's safe to
    call since freeing *is* delayed and it closes the race window - either
    lookup_ioctx() comes before percpu_ref_kill() (in which case ctx->users
    won't reach 0 until the caller of lookup_ioctx() drops it) or lookup_ioctx()
    fails, ctx->users is unaffected and caller of lookup_ioctx() doesn't see
    the object in question at all.
    
    Cc: stable@kernel.org
    Fixes: a6d7cff472e "fs/aio: Add explicit RCU grace period when freeing kioctx"
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0a75c38ae2057dc9314b9f63075c6c7c7042db67
Author: Dave Chinner <dchinner@redhat.com>
Date:   Fri May 11 11:20:57 2018 +1000

    fs: don't scan the inode cache before SB_BORN is set
    
    commit 79f546a696bff2590169fb5684e23d65f4d9f591 upstream.
    
    We recently had an oops reported on a 4.14 kernel in
    xfs_reclaim_inodes_count() where sb->s_fs_info pointed to garbage
    and so the m_perag_tree lookup walked into lala land.  It produces
    an oops down this path during the failed mount:
    
      radix_tree_gang_lookup_tag+0xc4/0x130
      xfs_perag_get_tag+0x37/0xf0
      xfs_reclaim_inodes_count+0x32/0x40
      xfs_fs_nr_cached_objects+0x11/0x20
      super_cache_count+0x35/0xc0
      shrink_slab.part.66+0xb1/0x370
      shrink_node+0x7e/0x1a0
      try_to_free_pages+0x199/0x470
      __alloc_pages_slowpath+0x3a1/0xd20
      __alloc_pages_nodemask+0x1c3/0x200
      cache_grow_begin+0x20b/0x2e0
      fallback_alloc+0x160/0x200
      kmem_cache_alloc+0x111/0x4e0
    
    The problem is that the superblock shrinker is running before the
    filesystem structures it depends on have been fully set up. i.e.
    the shrinker is registered in sget(), before ->fill_super() has been
    called, and the shrinker can call into the filesystem before
    fill_super() does it's setup work. Essentially we are exposed to
    both use-after-free and use-before-initialisation bugs here.
    
    To fix this, add a check for the SB_BORN flag in super_cache_count.
    In general, this flag is not set until ->fs_mount() completes
    successfully, so we know that it is set after the filesystem
    setup has completed. This matches the trylock_super() behaviour
    which will not let super_cache_scan() run if SB_BORN is not set, and
    hence will not allow the superblock shrinker from entering the
    filesystem while it is being set up or after it has failed setup
    and is being torn down.
    
    Cc: stable@kernel.org
    Signed-Off-By: Dave Chinner <dchinner@redhat.com>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 13b11c700cc2ee9b714c6c33579a6bdffb5ed002
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Wed Apr 25 10:28:38 2018 -0400

    fix breakage caused by d_find_alias() semantics change
    
    commit b127125d9db23e4856156a7c909a3c8e18b69f99 upstream.
    
    "VFS: don't keep disconnected dentries on d_anon" had a non-trivial
    side-effect - d_unhashed() now returns true for those dentries,
    making d_find_alias() skip them altogether.  For most of its callers
    that's fine - we really want a connected alias there.  However,
    there is a codepath where we relied upon picking such aliases
    if nothing else could be found - selinux delayed initialization
    of contexts for inodes on already mounted filesystems used to
    rely upon that.
    
    Cc: stable@kernel.org # f1ee616214cb "VFS: don't keep disconnected dentries on d_anon"
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3f4682df1217ab9583e13b21d5d5b6969479df63
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Sun May 6 12:15:20 2018 -0400

    affs_lookup(): close a race with affs_remove_link()
    
    commit 30da870ce4a4e007c901858a96e9e394a1daa74a upstream.
    
    we unlock the directory hash too early - if we are looking at secondary
    link and primary (in another directory) gets removed just as we unlock,
    we could have the old primary moved in place of the secondary, leaving
    us to look into freed entry (and leaving our dentry with ->d_fsdata
    pointing to a freed entry).
    
    Cc: stable@vger.kernel.org # 2.4.4+
    Acked-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f035321325889fa3cea15984742e6e0b3a48bfc5
Author: Colin Ian King <colin.king@canonical.com>
Date:   Mon May 14 18:23:50 2018 +0100

    KVM: Fix spelling mistake: "cop_unsuable" -> "cop_unusable"
    
    commit ba3696e94d9d590d9a7e55f68e81c25dba515191 upstream.
    
    Trivial fix to spelling mistake in debugfs_entries text.
    
    Fixes: 669e846e6c4e ("KVM/MIPS32: MIPS arch specific APIs for KVM")
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Cc: kernel-janitors@vger.kernel.org
    Cc: <stable@vger.kernel.org> # 3.10+
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 92bf557a7fd5150a116fa862287b0bf19d356441
Author: Maciej W. Rozycki <macro@mips.com>
Date:   Mon May 14 16:49:43 2018 +0100

    MIPS: Fix ptrace(2) PTRACE_PEEKUSR and PTRACE_POKEUSR accesses to o32 FGRs
    
    commit 9a3a92ccfe3620743d4ae57c987dc8e9c5f88996 upstream.
    
    Check the TIF_32BIT_FPREGS task setting of the tracee rather than the
    tracer in determining the layout of floating-point general registers in
    the floating-point context, correcting access to odd-numbered registers
    for o32 tracees where the setting disagrees between the two processes.
    
    Fixes: 597ce1723e0f ("MIPS: Support for 64-bit FP with O32 binaries")
    Signed-off-by: Maciej W. Rozycki <macro@mips.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Cc: <stable@vger.kernel.org> # 3.14+
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7ae9366090ad24219b7eb192599ed4ac9b950873
Author: Maciej W. Rozycki <macro@mips.com>
Date:   Mon Apr 30 15:56:47 2018 +0100

    MIPS: ptrace: Expose FIR register through FP regset
    
    commit 71e909c0cdad28a1df1fa14442929e68615dee45 upstream.
    
    Correct commit 7aeb753b5353 ("MIPS: Implement task_user_regset_view.")
    and expose the FIR register using the unused 4 bytes at the end of the
    NT_PRFPREG regset.  Without that register included clients cannot use
    the PTRACE_GETREGSET request to retrieve the complete FPU register set
    and have to resort to one of the older interfaces, either PTRACE_PEEKUSR
    or PTRACE_GETFPREGS, to retrieve the missing piece of data.  Also the
    register is irreversibly missing from core dumps.
    
    This register is architecturally hardwired and read-only so the write
    path does not matter.  Ignore data supplied on writes then.
    
    Fixes: 7aeb753b5353 ("MIPS: Implement task_user_regset_view.")
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Maciej W. Rozycki <macro@mips.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Cc: <stable@vger.kernel.org> # 3.13+
    Patchwork: https://patchwork.linux-mips.org/patch/19273/
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d34b69d56f88b9b3b9c30b59175dfc527f3d8122
Author: Paul Cercueil <paul@crapouillou.net>
Date:   Wed Mar 28 17:38:12 2018 +0200

    MIPS: Fix build with DEBUG_ZBOOT and MACH_JZ4770
    
    commit c60128ce97674fd05adb8b5ae79eb6745a03192e upstream.
    
    The debug definitions were missing for MACH_JZ4770, resulting in a build
    failure when DEBUG_ZBOOT was set.
    
    Since the UART addresses are the same across all Ingenic SoCs, we just
    use a #ifdef CONFIG_MACH_INGENIC instead of checking for individual
    Ingenic SoCs.
    
    Additionally, I added a #define for the UART0 address in-code and
    dropped the <asm/mach-jz4740/base.h> include, for the reason that this
    include file is slowly being phased out as the whole platform is being
    moved to devicetree.
    
    Fixes: 9be5f3e92ed5 ("MIPS: ingenic: Initial JZ4770 support")
    Signed-off-by: Paul Cercueil <paul@crapouillou.net>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Cc: <stable@vger.kernel.org> # 4.16
    Patchwork: https://patchwork.linux-mips.org/patch/18957/
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9ed61809e2bda6a0572d3e3861cc29894bed66f6
Author: NeilBrown <neil@brown.name>
Date:   Fri Apr 27 09:28:34 2018 +1000

    MIPS: c-r4k: Fix data corruption related to cache coherence
    
    commit 55a2aa08b3af519a9693f99cdf7fa6d8b62d9f65 upstream.
    
    When DMA will be performed to a MIPS32 1004K CPS, the L1-cache for the
    range needs to be flushed and invalidated first.
    The code currently takes one of two approaches.
    1/ If the range is less than the size of the dcache, then HIT type
       requests flush/invalidate cache lines for the particular addresses.
       HIT-type requests a globalised by the CPS so this is safe on SMP.
    
    2/ If the range is larger than the size of dcache, then INDEX type
       requests flush/invalidate the whole cache. INDEX type requests affect
       the local cache only. CPS does not propagate them in any way. So this
       invalidation is not safe on SMP CPS systems.
    
    Data corruption due to '2' can quite easily be demonstrated by
    repeatedly "echo 3 > /proc/sys/vm/drop_caches" and then sha1sum a file
    that is several times the size of available memory. Dropping caches
    means that large contiguous extents (large than dcache) are more likely.
    
    This was not a problem before Linux-4.8 because option 2 was never used
    if CONFIG_MIPS_CPS was defined. The commit which removed that apparently
    didn't appreciate the full consequence of the change.
    
    We could, in theory, globalize the INDEX based flush by sending an IPI
    to other cores. These cache invalidation routines can be called with
    interrupts disabled and synchronous IPI require interrupts to be
    enabled. Asynchronous IPI may not trigger writeback soon enough. So we
    cannot use IPI in practice.
    
    We can already test if IPI would be needed for an INDEX operation with
    r4k_op_needs_ipi(R4K_INDEX). If this is true then we mustn't try the
    INDEX approach as we cannot use IPI. If this is false (e.g. when there
    is only one core and hence one L1 cache) then it is safe to use the
    INDEX approach without IPI.
    
    This patch avoids options 2 if r4k_op_needs_ipi(R4K_INDEX), and so
    eliminates the corruption.
    
    Fixes: c00ab4896ed5 ("MIPS: Remove cpu_has_safe_index_cacheops")
    Signed-off-by: NeilBrown <neil@brown.name>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: Paul Burton <paul.burton@mips.com>
    Cc: linux-mips@linux-mips.org
    Cc: <stable@vger.kernel.org> # 4.8+
    Patchwork: https://patchwork.linux-mips.org/patch/19259/
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 37494c3ca0f1fbabbba3a07a5ebfb4e4128fc909
Author: Alexandre Belloni <alexandre.belloni@bootlin.com>
Date:   Wed Apr 25 23:10:36 2018 +0200

    MIPS: xilfpga: Actually include FDT in fitImage
    
    commit 947bc875116042d5375446aa29bc1073c2d38977 upstream.
    
    Commit b35565bb16a5 ("MIPS: generic: Add support for MIPSfpga") added
    and its.S file for xilfpga but forgot to add it to
    arch/mips/generic/Platform so it is never used.
    
    Fixes: b35565bb16a5 ("MIPS: generic: Add support for MIPSfpga")
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Cc: <stable@vger.kernel.org> # 4.15+
    Patchwork: https://patchwork.linux-mips.org/patch/19245/
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 44005c0951708df67dc1734f248a34a113022b5a
Author: Alexandre Belloni <alexandre.belloni@bootlin.com>
Date:   Wed Apr 25 23:10:35 2018 +0200

    MIPS: xilfpga: Stop generating useless dtb.o
    
    commit a5a92abbce56c41ff121db41a33b9c0a0ff39365 upstream.
    
    A dtb.o is generated from nexys4ddr.dts but this is never used since it
    has been moved to mips/generic with commit b35565bb16a5 ("MIPS: generic:
    Add support for MIPSfpga").
    
    Fixes: b35565bb16a5 ("MIPS: generic: Add support for MIPSfpga")
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Cc: <stable@vger.kernel.org> # 4.15+
    Patchwork: https://patchwork.linux-mips.org/patch/19244/
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
