commit bbfc30f29cb328111fec12975ded8223ecc8e1a5
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Dec 21 14:11:40 2018 +0100

    Linux 4.9.147

commit 1228a3336d90e2e3572ebaf1d959e3f51a10ea46
Author: Trent Piepho <tpiepho@impinj.com>
Date:   Wed May 16 16:45:51 2018 -0700

    rtc: snvs: Add timeouts to avoid kernel lockups
    
    [ Upstream commit cd7f3a249dbed2858e6c2f30e5be7f1f7a709ee2 ]
    
    In order to read correctly from asynchronously updated RTC registers,
    it's necessary to read repeatedly until their values do not change from
    read to read.  It's also necessary to wait for three RTC clock ticks for
    certain operations.  There are no timeouts in this code and these
    operations could possibly loop forever.
    
    To avoid kernel hangs, put in timeouts.
    
    The iMX7d can be configured to stop the SRTC on a tamper event, which
    will lockup the kernel inside this driver as described above.
    
    These hangs can happen when running under qemu, which doesn't emulate
    the SNVS RTC, though currently the driver will refuse to load on qemu
    due to a timeout in the driver probe method.
    
    It could also happen if the SRTC block where somehow placed into reset
    or the slow speed clock that drives the SRTC counter (but not the CPU)
    were to stop.
    
    The symptoms on a two core iMX7d are a work queue hang on
    rtc_timer_do_work(), which eventually blocks a systemd fsnotify
    operation that triggers a work queue flush, causing systemd to hang and
    thus causing all services that should be started by systemd, like a
    console getty, to fail to start or stop.
    
    Also optimize the wait code to wait less.  It only needs to wait for the
    clock to advance three ticks, not to see it change three times.
    
    Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
    Cc: Alessandro Zummo <a.zummo@towertech.it>
    Cc: Fabio Estevam <fabio.estevam@nxp.com>
    Cc: Shawn Guo <shawn.guo@linaro.org>
    Cc: Bryan O'Donoghue <pure.logic@nexus-software.ie>
    Signed-off-by: Trent Piepho <tpiepho@impinj.com>
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 54dbda74475e4e6fa8fd353c2cc599bda51fc5cc
Author: Guy Shapiro <guy.shapiro@mobi-wize.com>
Date:   Sun Jan 29 11:57:19 2017 +0200

    rtc: snvs: add a missing write sync
    
    [ Upstream commit 7bb633b1a9812a6b9f3e49d0cf17f60a633914e5 ]
    
    The clear of the LPTA_EN flag should be synced before writing to the
    alarm register. Omitting this synchronization creates a race when
    trying to change existing alarm.
    
    Signed-off-by: Guy Shapiro <guy.shapiro@mobi-wize.com>
    Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 36764b4a4363ef6dc5a6335acd3157c9dc94ebe4
Author: Israel Rukshin <israelr@mellanox.com>
Date:   Wed Dec 5 16:54:57 2018 +0000

    nvmet-rdma: fix response use after free
    
    [ Upstream commit d7dcdf9d4e15189ecfda24cc87339a3425448d5c ]
    
    nvmet_rdma_release_rsp() may free the response before using it at error
    flow.
    
    Fixes: 8407879 ("nvmet-rdma: fix possible bogus dereference under heavy load")
    Signed-off-by: Israel Rukshin <israelr@mellanox.com>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 89efcfc544ee1d9d4e68ec44d3932db3f3feb3b8
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Wed Nov 21 10:19:55 2018 +0100

    i2c: scmi: Fix probe error on devices with an empty SMB0001 ACPI device node
    
    [ Upstream commit 0544ee4b1ad574aec3b6379af5f5cdee42840971 ]
    
    Some AMD based HP laptops have a SMB0001 ACPI device node which does not
    define any methods.
    
    This leads to the following error in dmesg:
    
    [    5.222731] cmi: probe of SMB0001:00 failed with error -5
    
    This commit makes acpi_smbus_cmi_add() return -ENODEV instead in this case
    silencing the error. In case of a failure of the i2c_add_adapter() call
    this commit now propagates the error from that call instead of -EIO.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ebf838c7a160484e99b9e43203359815cde45809
Author: Adamski, Krzysztof (Nokia - PL/Wroclaw) <krzysztof.adamski@nokia.com>
Date:   Fri Nov 16 13:24:41 2018 +0000

    i2c: axxia: properly handle master timeout
    
    [ Upstream commit 6c7f25cae54b840302e4f1b371dbf318fbf09ab2 ]
    
    According to Intel (R) Axxia TM Lionfish Communication Processor
    Peripheral Subsystem Hardware Reference Manual, the AXXIA I2C module
    have a programmable Master Wait Timer, which among others, checks the
    time between commands send in manual mode. When a timeout (25ms) passes,
    TSS bit is set in Master Interrupt Status register and a Stop command is
    issued by the hardware.
    
    The axxia_i2c_xfer(), does not properly handle this situation, however.
    For each message a separate axxia_i2c_xfer_msg() is called and this
    function incorrectly assumes that any interrupt might happen only when
    waiting for completion. This is mostly correct but there is one
    exception - a master timeout can trigger if enough time has passed
    between individual transfers. It will, by definition, happen between
    transfers when the interrupts are disabled by the code. If that happens,
    the hardware issues Stop command.
    
    The interrupt indicating timeout will not be triggered as soon as we
    enable them since the Master Interrupt Status is cleared when master
    mode is entered again (which happens before enabling irqs) meaning this
    error is lost and the transfer is continued even though the Stop was
    issued on the bus. The subsequent operations completes without error but
    a bogus value (0xFF in case of read) is read as the client device is
    confused because aborted transfer. No error is returned from
    master_xfer() making caller believe that a valid value was read.
    
    To fix the problem, the TSS bit (indicating timeout) in Master Interrupt
    Status register is checked before each transfer. If it is set, there was
    a timeout before this transfer and (as described above) the hardware
    already issued Stop command so the transaction should be aborted thus
    -ETIMEOUT is returned from the master_xfer() callback. In order to be
    sure no timeout was issued we can't just read the status just before
    starting new transaction as there will always be a small window of time
    (few CPU cycles at best) where this might still happen. For this reason
    we have to temporally disable the timer before checking for TSS bit.
    Disabling it will, however, clear the TSS bit so in order to preserve
    that information, we have to read it in ISR so we have to ensure that
    the TSS interrupt is not masked between transfers of one transaction.
    There is no need to call bus recovery or controller reinitialization if
    that happens so it's skipped.
    
    Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com>
    Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 06ec6679fe12cacafce68ab7b509586482a2ae1b
Author: Stefan Hajnoczi <stefanha@redhat.com>
Date:   Thu Dec 6 19:14:34 2018 +0000

    vhost/vsock: fix reset orphans race with close timeout
    
    [ Upstream commit c38f57da428b033f2721b611d84b1f40bde674a8 ]
    
    If a local process has closed a connected socket and hasn't received a
    RST packet yet, then the socket remains in the table until a timeout
    expires.
    
    When a vhost_vsock instance is released with the timeout still pending,
    the socket is never freed because vhost_vsock has already set the
    SOCK_DONE flag.
    
    Check if the close timer is pending and let it close the socket.  This
    prevents the race which can leak sockets.
    
    Reported-by: Maximilian Riemensberger <riemensberger@cadami.net>
    Cc: Graham Whaley <graham.whaley@gmail.com>
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4cd376638c893cf5bf1072eeaac884f62b7ac71e
Author: Steve French <stfrench@microsoft.com>
Date:   Sat Nov 3 15:02:44 2018 -0500

    cifs: In Kconfig CONFIG_CIFS_POSIX needs depends on legacy (insecure cifs)
    
    [ Upstream commit 6e785302dad32228819d8066e5376acd15d0e6ba ]
    
    Missing a dependency.  Shouldn't show cifs posix extensions
    in Kconfig if CONFIG_CIFS_ALLOW_INSECURE_DIALECTS (ie SMB1
    protocol) is disabled.
    
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ba89274f0ec3656e11d0ffd0890480e2fcc3ca3b
Author: Sam Bobroff <sbobroff@linux.ibm.com>
Date:   Mon Dec 3 11:53:21 2018 +1100

    drm/ast: Fix connector leak during driver unload
    
    [ Upstream commit e594a5e349ddbfdaca1951bb3f8d72f3f1660d73 ]
    
    When unloading the ast driver, a warning message is printed by
    drm_mode_config_cleanup() because a reference is still held to one of
    the drm_connector structs.
    
    Correct this by calling drm_crtc_force_disable_all() in
    ast_fbdev_destroy().
    
    Signed-off-by: Sam Bobroff <sbobroff@linux.ibm.com>
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/1e613f3c630c7bbc72e04a44b178259b9164d2f6.1543798395.git.sbobroff@linux.ibm.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2198eb1229c245ee3eb2ae11877dc06c3777c279
Author: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Date:   Mon Dec 3 13:21:01 2018 +0100

    ethernet: fman: fix wrong of_node_put() in probe function
    
    [ Upstream commit ecb239d96d369c23c33d41708646df646de669f4 ]
    
    After getting a reference to the platform device's of_node the probe
    function ends up calling of_find_matching_node() using the node as an
    argument. The function takes care of decreasing the refcount on it. We
    are then incorrectly decreasing the refcount on that node again.
    
    This patch removes the unwarranted call to of_node_put().
    
    Fixes: 414fd46e7762 ("fsl/fman: Add FMan support")
    Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 493a06d37a28137b82e9d1cc380fe7ed0cae5030
Author: Vladimir Murzin <vladimir.murzin@arm.com>
Date:   Fri Nov 23 12:25:21 2018 +0100

    ARM: 8815/1: V7M: align v7m_dma_inv_range() with v7 counterpart
    
    [ Upstream commit 3d0358d0ba048c5afb1385787aaec8fa5ad78fcc ]
    
    Chris has discovered and reported that v7_dma_inv_range() may corrupt
    memory if address range is not aligned to cache line size.
    
    Since the whole cache-v7m.S was lifted form cache-v7.S the same
    observation applies to v7m_dma_inv_range(). So the fix just mirrors
    what has been done for v7 with a little specific of M-class.
    
    Cc: Chris Cole <chris@sageembedded.com>
    Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
    Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c711ec9a0f721b3d3a09bf1d3cc1fa23fa0cda04
Author: Chris Cole <chris@sageembedded.com>
Date:   Fri Nov 23 12:20:45 2018 +0100

    ARM: 8814/1: mm: improve/fix ARM v7_dma_inv_range() unaligned address handling
    
    [ Upstream commit a1208f6a822ac29933e772ef1f637c5d67838da9 ]
    
    This patch addresses possible memory corruption when
    v7_dma_inv_range(start_address, end_address) address parameters are not
    aligned to whole cache lines. This function issues "invalidate" cache
    management operations to all cache lines from start_address (inclusive)
    to end_address (exclusive). When start_address and/or end_address are
    not aligned, the start and/or end cache lines are first issued "clean &
    invalidate" operation. The assumption is this is done to ensure that any
    dirty data addresses outside the address range (but part of the first or
    last cache lines) are cleaned/flushed so that data is not lost, which
    could happen if just an invalidate is issued.
    
    The problem is that these first/last partial cache lines are issued
    "clean & invalidate" and then "invalidate". This second "invalidate" is
    not required and worse can cause "lost" writes to addresses outside the
    address range but part of the cache line. If another component writes to
    its part of the cache line between the "clean & invalidate" and
    "invalidate" operations, the write can get lost. This fix is to remove
    the extra "invalidate" operation when unaligned addressed are used.
    
    A kernel module is available that has a stress test to reproduce the
    issue and a unit test of the updated v7_dma_inv_range(). It can be
    downloaded from
    http://ftp.sageembedded.com/outgoing/linux/cache-test-20181107.tgz.
    
    v7_dma_inv_range() is call by dmac_[un]map_area(addr, len, direction)
    when the direction is DMA_FROM_DEVICE. One can (I believe) successfully
    argue that DMA from a device to main memory should use buffers aligned
    to cache line size, because the "clean & invalidate" might overwrite
    data that the device just wrote using DMA. But if a driver does use
    unaligned buffers, at least this fix will prevent memory corruption
    outside the buffer.
    
    Signed-off-by: Chris Cole <chris@sageembedded.com>
    Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ae30c98dcffd62635a86b967d75eabb07b53fed4
Author: Alexei Starovoitov <ast@kernel.org>
Date:   Mon Dec 3 22:46:04 2018 -0800

    bpf: check pending signals while verifying programs
    
    [ Upstream commit c3494801cd1785e2c25f1a5735fa19ddcf9665da ]
    
    Malicious user space may try to force the verifier to use as much cpu
    time and memory as possible. Hence check for pending signals
    while verifying the program.
    Note that suspend of sys_bpf(PROG_LOAD) syscall will lead to EAGAIN,
    since the kernel has to release the resources used for program verification.
    
    Reported-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Acked-by: Daniel Borkmann <daniel@iogearbox.net>
    Acked-by: Edward Cree <ecree@solarflare.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2b8b723ccf94371347346a7c247b708d0c8c9613
Author: Saeed Mahameed <saeedm@mellanox.com>
Date:   Sun Dec 2 14:34:37 2018 +0200

    net/mlx4_en: Fix build break when CONFIG_INET is off
    
    [ Upstream commit 1b603f9e4313348608f256b564ed6e3d9e67f377 ]
    
    MLX4_EN depends on NETDEVICES, ETHERNET and INET Kconfigs.
    Make sure they are listed in MLX4_EN Kconfig dependencies.
    
    This fixes the following build break:
    
    drivers/net/ethernet/mellanox/mlx4/en_rx.c:582:18: warning: ‘struct iphdr’ declared inside parameter list [enabled by default]
    struct iphdr *iph)
    ^
    drivers/net/ethernet/mellanox/mlx4/en_rx.c:582:18: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
    drivers/net/ethernet/mellanox/mlx4/en_rx.c: In function ‘get_fixed_ipv4_csum’:
    drivers/net/ethernet/mellanox/mlx4/en_rx.c:586:20: error: dereferencing pointer to incomplete type
    _u8 ipproto = iph->protocol;
    
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
    Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 24ed8c5302581cd70fe62533fb2969b7665e9ff1
Author: Anderson Luiz Alves <alacn1@gmail.com>
Date:   Fri Nov 30 21:58:36 2018 -0200

    mv88e6060: disable hardware level MAC learning
    
    [ Upstream commit a74515604a7b171f2702bdcbd1e231225fb456d0 ]
    
    Disable hardware level MAC learning because it breaks station roaming.
    When enabled it drops all frames that arrive from a MAC address
    that is on a different port at learning table.
    
    Signed-off-by: Anderson Luiz Alves <alacn1@gmail.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6705f748b0a2efe6352460e551398e13b8e68bef
Author: Juha-Matti Tilli <juha-matti.tilli@iki.fi>
Date:   Sun Dec 2 12:47:08 2018 +0200

    libata: whitelist all SAMSUNG MZ7KM* solid-state disks
    
    [ Upstream commit fd6f32f78645db32b6b95a42e45da2ddd6de0e67 ]
    
    These devices support read zero after trim (RZAT), as they advertise to
    the OS. However, the OS doesn't believe the SSDs unless they are
    explicitly whitelisted.
    
    Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Juha-Matti Tilli <juha-matti.tilli@iki.fi>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6ceb38129394c1a577dc02c4bc99993fa06d7ed2
Author: Tony Lindgren <tony@atomide.com>
Date:   Mon Dec 3 11:24:30 2018 -0800

    Input: omap-keypad - fix keyboard debounce configuration
    
    [ Upstream commit 6c3516fed7b61a3527459ccfa67fab130d910610 ]
    
    I noticed that the Android v3.0.8 kernel on droid4 is using different
    keypad values from the mainline kernel and does not have issues with
    keys occasionally being stuck until pressed again. Turns out there was
    an earlier patch posted to fix this as "Input: omap-keypad: errata i689:
    Correct debounce time", but it was never reposted to fix use macros
    for timing calculations.
    
    This updated version is using macros, and also fixes the use of the
    input clock rate to use 32768KiHz instead of 32000KiHz. And we want to
    use the known good Android kernel values of 3 and 6 instead of 2 and 6
    in the earlier patch.
    
    Reported-by: Pavel Machek <pavel@ucw.cz>
    Signed-off-by: Tony Lindgren <tony@atomide.com>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4ff9a2f211eade1f706a522285646ec5cfdd217e
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Mon Dec 3 17:51:43 2018 +0300

    clk: mmp: Off by one in mmp_clk_add()
    
    [ Upstream commit 2e85c57493e391b93445c1e0d530b36b95becc64 ]
    
    The > comparison should be >= or we write one element beyond the end of
    the unit->clk_table[] array.
    
    (The unit->clk_table[] array is allocated in the mmp_clk_init() function
    and it has unit->nr_clks elements).
    
    Fixes: 4661fda10f8b ("clk: mmp: add basic support functions for DT support")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 38391d6b11449ee86e3f6af003e4218ab95d3bec
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Mon Dec 3 17:50:55 2018 +0300

    clk: mvebu: Off by one bugs in cp110_of_clk_get()
    
    [ Upstream commit d9f5b7f5dd0fa74a89de5a7ac1e26366f211ccee ]
    
    These > comparisons should be >= to prevent reading beyond the end of
    of the clk_data->hws[] buffer.
    
    The clk_data->hws[] array is allocated in cp110_syscon_common_probe()
    when we do:
            cp110_clk_data = devm_kzalloc(dev, sizeof(*cp110_clk_data) +
                                          sizeof(struct clk_hw *) * CP110_CLK_NUM,
                                          GFP_KERNEL);
    As you can see, it has CP110_CLK_NUM elements which is equivalent to
    CP110_MAX_CORE_CLOCKS + CP110_MAX_GATABLE_CLOCKS.
    
    Fixes: d3da3eaef7f4 ("clk: mvebu: new driver for Armada CP110 system controller")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6ecd4ae6760c043afb9b1920c45fca2906e7ffb0
Author: Yangtao Li <tiny.windzz@gmail.com>
Date:   Tue Nov 20 08:02:49 2018 -0500

    ide: pmac: add of_node_put()
    
    [ Upstream commit a51921c0db3fd26c4ed83dc0ec5d32988fa02aa5 ]
    
    use of_node_put() to release the refcount.
    
    Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f969b24ec770d40270ae43dfc0ac68c96db56f55
Author: Yangtao Li <tiny.windzz@gmail.com>
Date:   Wed Nov 21 10:22:54 2018 -0500

    drivers/tty: add missing of_node_put()
    
    [ Upstream commit dac097c4546e4c5b16dd303a1e97c1d319c8ab3e ]
    
    of_find_node_by_path() acquires a reference to the node
    returned by it and that reference needs to be dropped by its caller.
    This place is not doing this, so fix it.
    
    Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 076bb557eeacb0366dd079bbab72acc0a6de2175
Author: Yangtao Li <tiny.windzz@gmail.com>
Date:   Tue Nov 20 08:38:26 2018 -0500

    drivers/sbus/char: add of_node_put()
    
    [ Upstream commit 6bd520ab7cf69486ea81fd3cdfd2d5a390ad1100 ]
    
    use of_node_put() to release the refcount.
    
    Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 38d3f5fb60cecc34e8b7906d73dde635b14ed6de
Author: Yangtao Li <tiny.windzz@gmail.com>
Date:   Tue Nov 20 08:30:40 2018 -0500

    sbus: char: add of_node_put()
    
    [ Upstream commit 87d81a23e24f24ebe014891e8bdf3ff8785031e8 ]
    
    use of_node_put() to release the refcount.
    
    Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5ba8d8b5a27c3d50f6544d1ce8c6732c8b36aedc
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Sat Dec 1 23:18:00 2018 -0500

    SUNRPC: Fix a potential race in xprt_connect()
    
    [ Upstream commit 0a9a4304f3614e25d9de9b63502ca633c01c0d70 ]
    
    If an asynchronous connection attempt completes while another task is
    in xprt_connect(), then the call to rpc_sleep_on() could end up
    racing with the call to xprt_wake_pending_tasks().
    So add a second test of the connection state after we've put the
    task to sleep and set the XPRT_CONNECTING flag, when we know that there
    can be no asynchronous connection attempts still in progress.
    
    Fixes: 0b9e79431377d ("SUNRPC: Move the test for XPRT_CONNECTING into...")
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit de42cd219802457caa61c001776281fe42deae9d
Author: Dave Kleikamp <dave.kleikamp@oracle.com>
Date:   Tue Nov 27 19:31:30 2018 +0000

    nfs: don't dirty kernel pages read by direct-io
    
    [ Upstream commit ad3cba223ac02dc769c3bbe88efe277bbb457566 ]
    
    When we use direct_IO with an NFS backing store, we can trigger a
    WARNING in __set_page_dirty(), as below, since we're dirtying the page
    unnecessarily in nfs_direct_read_completion().
    
    To fix, replicate the logic in commit 53cbf3b157a0 ("fs: direct-io:
    don't dirtying pages for ITER_BVEC/ITER_KVEC direct read").
    
    Other filesystems that implement direct_IO handle this; most use
    blockdev_direct_IO(). ceph and cifs have similar logic.
    
    mount 127.0.0.1:/export /nfs
    dd if=/dev/zero of=/nfs/image bs=1M count=200
    losetup --direct-io=on -f /nfs/image
    mkfs.btrfs /dev/loop0
    mount -t btrfs /dev/loop0 /mnt/
    
    kernel: WARNING: CPU: 0 PID: 8067 at fs/buffer.c:580 __set_page_dirty+0xaf/0xd0
    kernel: Modules linked in: loop(E) nfsv3(E) rpcsec_gss_krb5(E) nfsv4(E) dns_resolver(E) nfs(E) fscache(E) nfsd(E) auth_rpcgss(E) nfs_acl(E) lockd(E) grace(E) fuse(E) tun(E) ip6t_rpfilter(E) ipt_REJECT(E) nf_
    kernel:  snd_seq(E) snd_seq_device(E) snd_pcm(E) video(E) snd_timer(E) snd(E) soundcore(E) ip_tables(E) xfs(E) libcrc32c(E) sd_mod(E) sr_mod(E) cdrom(E) ata_generic(E) pata_acpi(E) crc32c_intel(E) ahci(E) li
    kernel: CPU: 0 PID: 8067 Comm: kworker/0:2 Tainted: G            E     4.20.0-rc1.master.20181111.ol7.x86_64 #1
    kernel: Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
    kernel: Workqueue: nfsiod rpc_async_release [sunrpc]
    kernel: RIP: 0010:__set_page_dirty+0xaf/0xd0
    kernel: Code: c3 48 8b 02 f6 c4 04 74 d4 48 89 df e8 ba 05 f7 ff 48 89 c6 eb cb 48 8b 43 08 a8 01 75 1f 48 89 d8 48 8b 00 a8 04 74 02 eb 87 <0f> 0b eb 83 48 83 e8 01 eb 9f 48 83 ea 01 0f 1f 00 eb 8b 48 83 e8
    kernel: RSP: 0000:ffffc1c8825b7d78 EFLAGS: 00013046
    kernel: RAX: 000fffffc0020089 RBX: fffff2b603308b80 RCX: 0000000000000001
    kernel: RDX: 0000000000000001 RSI: ffff9d11478115c8 RDI: ffff9d11478115d0
    kernel: RBP: ffffc1c8825b7da0 R08: 0000646f6973666e R09: 8080808080808080
    kernel: R10: 0000000000000001 R11: 0000000000000000 R12: ffff9d11478115d0
    kernel: R13: ffff9d11478115c8 R14: 0000000000003246 R15: 0000000000000001
    kernel: FS:  0000000000000000(0000) GS:ffff9d115ba00000(0000) knlGS:0000000000000000
    kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    kernel: CR2: 00007f408686f640 CR3: 0000000104d8e004 CR4: 00000000000606f0
    kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    kernel: DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    kernel: Call Trace:
    kernel:  __set_page_dirty_buffers+0xb6/0x110
    kernel:  set_page_dirty+0x52/0xb0
    kernel:  nfs_direct_read_completion+0xc4/0x120 [nfs]
    kernel:  nfs_pgio_release+0x10/0x20 [nfs]
    kernel:  rpc_free_task+0x30/0x70 [sunrpc]
    kernel:  rpc_async_release+0x12/0x20 [sunrpc]
    kernel:  process_one_work+0x174/0x390
    kernel:  worker_thread+0x4f/0x3e0
    kernel:  kthread+0x102/0x140
    kernel:  ? drain_workqueue+0x130/0x130
    kernel:  ? kthread_stop+0x110/0x110
    kernel:  ret_from_fork+0x35/0x40
    kernel: ---[ end trace 01341980905412c9 ]---
    
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
    
    [forward-ported to v4.20]
    Signed-off-by: Calum Mackay <calum.mackay@oracle.com>
    Reviewed-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2eb7e6fd37fb99c2476f2c6299efaaecbc19f2c5
Author: Toni Peltonen <peltzi@peltzi.fi>
Date:   Tue Nov 27 16:56:57 2018 +0200

    bonding: fix 802.3ad state sent to partner when unbinding slave
    
    [ Upstream commit 3b5b3a3331d141e8f2a7aaae3a94dfa1e61ecbe4 ]
    
    Previously when unbinding a slave the 802.3ad implementation only told
    partner that the port is not suitable for aggregation by setting the port
    aggregation state from aggregatable to individual. This is not enough. If the
    physical layer still stays up and we only unbinded this port from the bond there
    is nothing in the aggregation status alone to prevent the partner from sending
    traffic towards us. To ensure that the partner doesn't consider this
    port at all anymore we should also disable collecting and distributing to
    signal that this actor is going away. Also clear AD_STATE_SYNCHRONIZATION to
    ensure partner exits collecting + distributing state.
    
    I have tested this behaviour againts Arista EOS switches with mlx5 cards
    (physical link stays up even when interface is down) and simulated
    the same situation virtually Linux <-> Linux with two network namespaces
    running two veth device pairs. In both cases setting aggregation to
    individual doesn't alone prevent traffic from being to sent towards this
    port given that the link stays up in partners end. Partner still keeps
    it's end in collecting + distributing state and continues until timeout is
    reached. In most cases this means we are losing the traffic partner sends
    towards our port while we wait for timeout. This is most visible with slow
    periodic time (LACP rate slow).
    
    Other open source implementations like Open VSwitch and libreswitch, and
    vendor implementations like Arista EOS, seem to disable collecting +
    distributing to when doing similar port disabling/detaching/removing change.
    With this patch kernel implementation would behave the same way and ensure
    partner doesn't consider our actor viable anymore.
    
    Signed-off-by: Toni Peltonen <peltzi@peltzi.fi>
    Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
    Acked-by: Jonathan Toppins <jtoppins@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit beab9a76d4916e7477dc5f288ffb4149813c56be
Author: Jose Abreu <joabreu@synopsys.com>
Date:   Fri Nov 30 09:47:31 2018 +0000

    ARC: io.h: Implement reads{x}()/writes{x}()
    
    [ Upstream commit 10d443431dc2bb733cf7add99b453e3fb9047a2e ]
    
    Some ARC CPU's do not support unaligned loads/stores. Currently, generic
    implementation of reads{b/w/l}()/writes{b/w/l}() is being used with ARC.
    This can lead to misfunction of some drivers as generic functions do a
    plain dereference of a pointer that can be unaligned.
    
    Let's use {get/put}_unaligned() helpers instead of plain dereference of
    pointer in order to fix. The helpers allow to get and store data from an
    unaligned address whilst preserving the CPU internal alignment.
    According to [1], the use of these helpers are costly in terms of
    performance so we added an initial check for a buffer already aligned so
    that the usage of the helpers can be avoided, when possible.
    
    [1] Documentation/unaligned-memory-access.txt
    
    Cc: Alexey Brodkin <abrodkin@synopsys.com>
    Cc: Joao Pinto <jpinto@synopsys.com>
    Cc: David Laight <David.Laight@ACULAB.COM>
    Tested-by: Vitor Soares <soares@synopsys.com>
    Signed-off-by: Jose Abreu <joabreu@synopsys.com>
    Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 945d5195c61222c4cfb222c076309f04464df81c
Author: Sean Paul <seanpaul@chromium.org>
Date:   Wed Oct 3 16:22:31 2018 -0400

    drm/msm: Grab a vblank reference when waiting for commit_done
    
    [ Upstream commit 3b712e43e3876b42b38321ecf790a1f5fe59c834 ]
    
    Similar to the atomic helpers, we should enable vblank while we're
    waiting for the commit to finish. DPU needs this, MDP5 seems to work
    fine without it.
    
    Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
    Signed-off-by: Sean Paul <seanpaul@chromium.org>
    Signed-off-by: Rob Clark <robdclark@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 01edb9812380b6f9f321523fbb4e09377a2af208
Author: YiFei Zhu <zhuyifei1999@gmail.com>
Date:   Thu Nov 29 18:12:30 2018 +0100

    x86/earlyprintk/efi: Fix infinite loop on some screen widths
    
    [ Upstream commit 79c2206d369b87b19ac29cb47601059b6bf5c291 ]
    
    An affected screen resolution is 1366 x 768, which width is not
    divisible by 8, the default font width. On such screens, when longer
    lines are earlyprintk'ed, overflow-to-next-line can never trigger,
    due to the left-most x-coordinate of the next character always less
    than the screen width. Earlyprintk will infinite loop in trying to
    print the rest of the string but unable to, due to the line being
    full.
    
    This patch makes the trigger consider the right-most x-coordinate,
    instead of left-most, as the value to compare against the screen
    width threshold.
    
    Signed-off-by: YiFei Zhu <zhuyifei1999@gmail.com>
    Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Arend van Spriel <arend.vanspriel@broadcom.com>
    Cc: Bhupesh Sharma <bhsharma@redhat.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: Eric Snowberg <eric.snowberg@oracle.com>
    Cc: Hans de Goede <hdegoede@redhat.com>
    Cc: Joe Perches <joe@perches.com>
    Cc: Jon Hunter <jonathanh@nvidia.com>
    Cc: Julien Thierry <julien.thierry@arm.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Marc Zyngier <marc.zyngier@arm.com>
    Cc: Matt Fleming <matt@codeblueprint.co.uk>
    Cc: Nathan Chancellor <natechancellor@gmail.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
    Cc: Sedat Dilek <sedat.dilek@gmail.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: linux-efi@vger.kernel.org
    Link: http://lkml.kernel.org/r/20181129171230.18699-12-ard.biesheuvel@linaro.org
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7f928ef277bbafdf3d970502799cad70c3d870f5
Author: Cathy Avery <cavery@redhat.com>
Date:   Tue Nov 27 14:28:53 2018 -0500

    scsi: vmw_pscsi: Rearrange code to avoid multiple calls to free_irq during unload
    
    [ Upstream commit 02f425f811cefcc4d325d7a72272651e622dc97e ]
    
    Currently pvscsi_remove calls free_irq more than once as
    pvscsi_release_resources and __pvscsi_shutdown both call
    pvscsi_shutdown_intr. This results in a 'Trying to free already-free IRQ'
    warning and stack trace. To solve the problem pvscsi_shutdown_intr has been
    moved out of pvscsi_release_resources.
    
    Signed-off-by: Cathy Avery <cavery@redhat.com>
    Reviewed-by: Ewan D. Milne <emilne@redhat.com>
    Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2ee718b1c537c597be502fcd85810b99ff7f4ff9
Author: Fred Herard <fred.herard@oracle.com>
Date:   Tue Nov 20 20:22:45 2018 -0500

    scsi: libiscsi: Fix NULL pointer dereference in iscsi_eh_session_reset
    
    [ Upstream commit 5db6dd14b31397e8cccaaddab2ff44ebec1acf25 ]
    
    This commit addresses NULL pointer dereference in iscsi_eh_session_reset.
    Reference should not be made to session->leadconn when session->state is
    set to ISCSI_STATE_TERMINATE.
    
    Signed-off-by: Fred Herard <fred.herard@oracle.com>
    Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Reviewed-by: Lee Duncan <lduncan@suse.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3e5d4c14a7427dc2a24737c8dcc61688870d737a
Author: Alexey Khoroshilov <khoroshilov@ispras.ru>
Date:   Fri Oct 5 23:22:06 2018 +0300

    mac80211_hwsim: fix module init error paths for netlink
    
    [ Upstream commit 05cc09de4c017663a217630682041066f2f9a5cd ]
    
    There is no unregister netlink notifier and family on error paths
    in init_mac80211_hwsim(). Also there is an error path where
    hwsim_class is not destroyed.
    
    Found by Linux Driver Verification project (linuxtesting.org).
    
    Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
    Fixes: 62759361eb49 ("mac80211-hwsim: Provide multicast event for HWSIM_CMD_NEW_RADIO")
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c6bcf40f769294a80c64213f9175ccd408d64532
Author: Steven Rostedt (VMware) <rostedt@goodmis.org>
Date:   Thu Jun 21 20:35:26 2018 -0400

    locking/qspinlock: Fix build for anonymous union in older GCC compilers
    
    [ Upstream commit 6cc65be4f6f2a7186af8f3e09900787c7912dad2 ]
    
    One of my tests compiles the kernel with gcc 4.5.3, and I hit the
    following build error:
    
      include/linux/semaphore.h: In function 'sema_init':
      include/linux/semaphore.h:35:17: error: unknown field 'val' specified in initializer
      include/linux/semaphore.h:35:17: warning: missing braces around initializer
      include/linux/semaphore.h:35:17: warning: (near initialization for '(anonymous).raw_lock.<anonymous>.val')
    
    I bisected it down to:
    
     625e88be1f41 ("locking/qspinlock: Merge 'struct __qspinlock' into 'struct qspinlock'")
    
    ... which makes qspinlock have an anonymous union, which makes initializing it special
    for older compilers. By adding strategic brackets, it makes the build
    happy again.
    
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Acked-by: Waiman Long <longman@redhat.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Boqun Feng <boqun.feng@gmail.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: linux-arm-kernel@lists.infradead.org
    Fixes: 625e88be1f41 ("locking/qspinlock: Merge 'struct __qspinlock' into 'struct qspinlock'")
    Link: http://lkml.kernel.org/r/20180621203526.172ab5c4@vmware.local.home
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 88ce30fb88a192d8bf3b789122030a85e6c3ce5a
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Tue Dec 18 23:10:49 2018 +0100

    locking/qspinlock, x86: Provide liveness guarantee
    
    commit 7aa54be2976550f17c11a1c3e3630002dea39303 upstream.
    
    On x86 we cannot do fetch_or() with a single instruction and thus end up
    using a cmpxchg loop, this reduces determinism. Replace the fetch_or()
    with a composite operation: tas-pending + load.
    
    Using two instructions of course opens a window we previously did not
    have. Consider the scenario:
    
            CPU0            CPU1            CPU2
    
     1)     lock
              trylock -> (0,0,1)
    
     2)                     lock
                              trylock /* fail */
    
     3)     unlock -> (0,0,0)
    
     4)                                     lock
                                              trylock -> (0,0,1)
    
     5)                       tas-pending -> (0,1,1)
                              load-val <- (0,1,0) from 3
    
     6)                       clear-pending-set-locked -> (0,0,1)
    
                              FAIL: _2_ owners
    
    where 5) is our new composite operation. When we consider each part of
    the qspinlock state as a separate variable (as we can when
    _Q_PENDING_BITS == 8) then the above is entirely possible, because
    tas-pending will only RmW the pending byte, so the later load is able
    to observe prior tail and lock state (but not earlier than its own
    trylock, which operates on the whole word, due to coherence).
    
    To avoid this we need 2 things:
    
     - the load must come after the tas-pending (obviously, otherwise it
       can trivially observe prior state).
    
     - the tas-pending must be a full word RmW instruction, it cannot be an XCHGB for
       example, such that we cannot observe other state prior to setting
       pending.
    
    On x86 we can realize this by using "LOCK BTS m32, r32" for
    tas-pending followed by a regular load.
    
    Note that observing later state is not a problem:
    
     - if we fail to observe a later unlock, we'll simply spin-wait for
       that store to become visible.
    
     - if we observe a later xchg_tail(), there is no difference from that
       xchg_tail() having taken place before the tas-pending.
    
    Suggested-by: Will Deacon <will.deacon@arm.com>
    Reported-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Will Deacon <will.deacon@arm.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: andrea.parri@amarulasolutions.com
    Cc: longman@redhat.com
    Fixes: 59fb586b4a07 ("locking/qspinlock: Remove unbounded cmpxchg() loop from locking slowpath")
    Link: https://lkml.kernel.org/r/20181003130957.183726335@infradead.org
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    [bigeasy: GEN_BINARY_RMWcc macro redo]
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8ae5642df23de3d2fce8f176943c0739abbeb9da
Author: Will Deacon <will.deacon@arm.com>
Date:   Tue Dec 18 23:10:48 2018 +0100

    locking/qspinlock/x86: Increase _Q_PENDING_LOOPS upper bound
    
    commit b247be3fe89b6aba928bf80f4453d1c4ba8d2063 upstream.
    
    On x86, atomic_cond_read_relaxed will busy-wait with a cpu_relax() loop,
    so it is desirable to increase the number of times we spin on the qspinlock
    lockword when it is found to be transitioning from pending to locked.
    
    According to Waiman Long:
    
     | Ideally, the spinning times should be at least a few times the typical
     | cacheline load time from memory which I think can be down to 100ns or
     | so for each cacheline load with the newest systems or up to several
     | hundreds ns for older systems.
    
    which in his benchmarking corresponded to 512 iterations.
    
    Suggested-by: Waiman Long <longman@redhat.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Waiman Long <longman@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: boqun.feng@gmail.com
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: paulmck@linux.vnet.ibm.com
    Link: http://lkml.kernel.org/r/1524738868-31318-5-git-send-email-will.deacon@arm.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f650bdcabf560f530b74a2266a17549fdf084161
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Tue Dec 18 23:10:47 2018 +0100

    locking/qspinlock: Re-order code
    
    commit 53bf57fab7321fb42b703056a4c80fc9d986d170 upstream.
    
    Flip the branch condition after atomic_fetch_or_acquire(_Q_PENDING_VAL)
    such that we loose the indent. This also result in a more natural code
    flow IMO.
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Will Deacon <will.deacon@arm.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: andrea.parri@amarulasolutions.com
    Cc: longman@redhat.com
    Link: https://lkml.kernel.org/r/20181003130257.156322446@infradead.org
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0952e8f0e62456d7b6eb0abb3f71213b7630cf0f
Author: Will Deacon <will.deacon@arm.com>
Date:   Tue Dec 18 23:10:46 2018 +0100

    locking/qspinlock: Kill cmpxchg() loop when claiming lock from head of queue
    
    commit c61da58d8a9ba9238250a548f00826eaf44af0f7 upstream.
    
    When a queued locker reaches the head of the queue, it claims the lock
    by setting _Q_LOCKED_VAL in the lockword. If there isn't contention, it
    must also clear the tail as part of this operation so that subsequent
    lockers can avoid taking the slowpath altogether.
    
    Currently this is expressed as a cmpxchg() loop that practically only
    runs up to two iterations. This is confusing to the reader and unhelpful
    to the compiler. Rewrite the cmpxchg() loop without the loop, so that a
    failed cmpxchg() implies that there is contention and we just need to
    write to _Q_LOCKED_VAL without considering the rest of the lockword.
    
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Waiman Long <longman@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: boqun.feng@gmail.com
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: paulmck@linux.vnet.ibm.com
    Link: http://lkml.kernel.org/r/1524738868-31318-7-git-send-email-will.deacon@arm.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0f28d5f4ce393354e50de2da743dc04e7bcd8667
Author: Will Deacon <will.deacon@arm.com>
Date:   Tue Dec 18 23:10:45 2018 +0100

    locking/qspinlock: Remove duplicate clear_pending() function from PV code
    
    commit 3bea9adc96842b8a7345c7fb202c16ae9c8d5b25 upstream.
    
    The native clear_pending() function is identical to the PV version, so the
    latter can simply be removed.
    
    This fixes the build for systems with >= 16K CPUs using the PV lock implementation.
    
    Reported-by: Waiman Long <longman@redhat.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: boqun.feng@gmail.com
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: paulmck@linux.vnet.ibm.com
    Link: http://lkml.kernel.org/r/20180427101619.GB21705@arm.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9b5884372c792b0dade0cf22390a9516c870b7d7
Author: Will Deacon <will.deacon@arm.com>
Date:   Tue Dec 18 23:10:44 2018 +0100

    locking/qspinlock: Remove unbounded cmpxchg() loop from locking slowpath
    
    commit 59fb586b4a07b4e1a0ee577140ab4842ba451acd upstream.
    
    The qspinlock locking slowpath utilises a "pending" bit as a simple form
    of an embedded test-and-set lock that can avoid the overhead of explicit
    queuing in cases where the lock is held but uncontended. This bit is
    managed using a cmpxchg() loop which tries to transition the uncontended
    lock word from (0,0,0) -> (0,0,1) or (0,0,1) -> (0,1,1).
    
    Unfortunately, the cmpxchg() loop is unbounded and lockers can be starved
    indefinitely if the lock word is seen to oscillate between unlocked
    (0,0,0) and locked (0,0,1). This could happen if concurrent lockers are
    able to take the lock in the cmpxchg() loop without queuing and pass it
    around amongst themselves.
    
    This patch fixes the problem by unconditionally setting _Q_PENDING_VAL
    using atomic_fetch_or, and then inspecting the old value to see whether
    we need to spin on the current lock owner, or whether we now effectively
    hold the lock. The tricky scenario is when concurrent lockers end up
    queuing on the lock and the lock becomes available, causing us to see
    a lockword of (n,0,0). With pending now set, simply queuing could lead
    to deadlock as the head of the queue may not have observed the pending
    flag being cleared. Conversely, if the head of the queue did observe
    pending being cleared, then it could transition the lock from (n,0,0) ->
    (0,0,1) meaning that any attempt to "undo" our setting of the pending
    bit could race with a concurrent locker trying to set it.
    
    We handle this race by preserving the pending bit when taking the lock
    after reaching the head of the queue and leaving the tail entry intact
    if we saw pending set, because we know that the tail is going to be
    updated shortly.
    
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Waiman Long <longman@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: boqun.feng@gmail.com
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: paulmck@linux.vnet.ibm.com
    Link: http://lkml.kernel.org/r/1524738868-31318-6-git-send-email-will.deacon@arm.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 60668f3cddf1b25a954b198cade0ce726a6853ab
Author: Will Deacon <will.deacon@arm.com>
Date:   Tue Dec 18 23:10:43 2018 +0100

    locking/qspinlock: Merge 'struct __qspinlock' into 'struct qspinlock'
    
    commit 625e88be1f41b53cec55827c984e4a89ea8ee9f9 upstream.
    
    'struct __qspinlock' provides a handy union of fields so that
    subcomponents of the lockword can be accessed by name, without having to
    manage shifts and masks explicitly and take endianness into account.
    
    This is useful in qspinlock.h and also potentially in arch headers, so
    move the 'struct __qspinlock' into 'struct qspinlock' and kill the extra
    definition.
    
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Waiman Long <longman@redhat.com>
    Acked-by: Boqun Feng <boqun.feng@gmail.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: paulmck@linux.vnet.ibm.com
    Link: http://lkml.kernel.org/r/1524738868-31318-3-git-send-email-will.deacon@arm.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8e5b3bcc5291092aaac4cadc0b5fb46182172ed3
Author: Will Deacon <will.deacon@arm.com>
Date:   Tue Dec 18 23:10:42 2018 +0100

    locking/qspinlock: Bound spinning on pending->locked transition in slowpath
    
    commit 6512276d97b160d90b53285bd06f7f201459a7e3 upstream.
    
    If a locker taking the qspinlock slowpath reads a lock value indicating
    that only the pending bit is set, then it will spin whilst the
    concurrent pending->locked transition takes effect.
    
    Unfortunately, there is no guarantee that such a transition will ever be
    observed since concurrent lockers could continuously set pending and
    hand over the lock amongst themselves, leading to starvation. Whilst
    this would probably resolve in practice, it means that it is not
    possible to prove liveness properties about the lock and means that lock
    acquisition time is unbounded.
    
    Rather than removing the pending->locked spinning from the slowpath
    altogether (which has been shown to heavily penalise a 2-threaded
    locking stress test on x86), this patch replaces the explicit spinning
    with a call to atomic_cond_read_relaxed and allows the architecture to
    provide a bound on the number of spins. For architectures that can
    respond to changes in cacheline state in their smp_cond_load implementation,
    it should be sufficient to use the default bound of 1.
    
    Suggested-by: Waiman Long <longman@redhat.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Waiman Long <longman@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: boqun.feng@gmail.com
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: paulmck@linux.vnet.ibm.com
    Link: http://lkml.kernel.org/r/1524738868-31318-4-git-send-email-will.deacon@arm.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 48c42d4dfec408760d15acc334d91208a6b2262e
Author: Will Deacon <will.deacon@arm.com>
Date:   Tue Dec 18 23:10:41 2018 +0100

    locking/qspinlock: Ensure node is initialised before updating prev->next
    
    commit 95bcade33a8af38755c9b0636e36a36ad3789fe6 upstream.
    
    When a locker ends up queuing on the qspinlock locking slowpath, we
    initialise the relevant mcs node and publish it indirectly by updating
    the tail portion of the lock word using xchg_tail. If we find that there
    was a pre-existing locker in the queue, we subsequently update their
    ->next field to point at our node so that we are notified when it's our
    turn to take the lock.
    
    This can be roughly illustrated as follows:
    
      /* Initialise the fields in node and encode a pointer to node in tail */
      tail = initialise_node(node);
    
      /*
       * Exchange tail into the lockword using an atomic read-modify-write
       * operation with release semantics
       */
      old = xchg_tail(lock, tail);
    
      /* If there was a pre-existing waiter ... */
      if (old & _Q_TAIL_MASK) {
            prev = decode_tail(old);
            smp_read_barrier_depends();
    
            /* ... then update their ->next field to point to node.
            WRITE_ONCE(prev->next, node);
      }
    
    The conditional update of prev->next therefore relies on the address
    dependency from the result of xchg_tail ensuring order against the
    prior initialisation of node. However, since the release semantics of
    the xchg_tail operation apply only to the write portion of the RmW,
    then this ordering is not guaranteed and it is possible for the CPU
    to return old before the writes to node have been published, consequently
    allowing us to point prev->next to an uninitialised node.
    
    This patch fixes the problem by making the update of prev->next a RELEASE
    operation, which also removes the reliance on dependency ordering.
    
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/1518528177-19169-2-git-send-email-will.deacon@arm.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c3b6e79fbf295c9cda4dd1828a8f0593cad53d48
Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Date:   Tue Dec 18 23:10:40 2018 +0100

    locking: Remove smp_read_barrier_depends() from queued_spin_lock_slowpath()
    
    commit 548095dea63ffc016d39c35b32c628d033638aca upstream.
    
    Queued spinlocks are not used by DEC Alpha, and furthermore operations
    such as READ_ONCE() and release/relaxed RMW atomics are being changed
    to imply smp_read_barrier_depends().  This commit therefore removes the
    now-redundant smp_read_barrier_depends() from queued_spin_lock_slowpath(),
    and adjusts the comments accordingly.
    
    Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d395117fac7943da6966ccbac3b95651f5581f15
Author: Michael J. Ruhl <michael.j.ruhl@intel.com>
Date:   Tue Dec 18 16:08:32 2018 -0500

    IB/hfi1: Remove race conditions in user_sdma send path
    
    commit 28a9a9e83ceae2cee25b9af9ad20d53aaa9ab951 upstream
    
    Packet queue state is over used to determine SDMA descriptor
    availablitity and packet queue request state.
    
    cpu 0  ret = user_sdma_send_pkts(req, pcount);
    cpu 0  if (atomic_read(&pq->n_reqs))
    cpu 1  IRQ user_sdma_txreq_cb calls pq_update() (state to _INACTIVE)
    cpu 0        xchg(&pq->state, SDMA_PKT_Q_ACTIVE);
    
    At this point pq->n_reqs == 0 and pq->state is incorrectly
    SDMA_PKT_Q_ACTIVE.  The close path will hang waiting for the state
    to return to _INACTIVE.
    
    This can also change the state from _DEFERRED to _ACTIVE.  However,
    this is a mostly benign race.
    
    Remove the racy code path.
    
    Use n_reqs to determine if a packet queue is active or not.
    
    Cc: <stable@vger.kernel.org> # 4.9.0
    Reviewed-by: Mitko Haralanov <mitko.haralanov@intel.com>
    Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
    Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0715895a55b42f6218f194ce174efa72e34484d6
Author: Ilan Peer <ilan.peer@intel.com>
Date:   Tue Apr 3 11:35:22 2018 +0300

    mac80211: Fix condition validating WMM IE
    
    [ Upstream commit 911a26484c33e10de6237228ca1d7293548e9f49 ]
    
    Commit c470bdc1aaf3 ("mac80211: don't WARN on bad WMM parameters from
    buggy APs") handled cases where an AP reports a zeroed WMM
    IE. However, the condition that checks the validity accessed the wrong
    index in the ieee80211_tx_queue_params array, thus wrongly deducing
    that the parameters are invalid. Fix it.
    
    Fixes: c470bdc1aaf3 ("mac80211: don't WARN on bad WMM parameters from buggy APs")
    Signed-off-by: Ilan Peer <ilan.peer@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7a4b56ae85f67f749df6c8d7a8f92d2cab880904
Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Date:   Mon Mar 26 16:21:04 2018 +0300

    mac80211: don't WARN on bad WMM parameters from buggy APs
    
    [ Upstream commit c470bdc1aaf36669e04ba65faf1092b2d1c6cabe ]
    
    Apparently, some APs are buggy enough to send a zeroed
    WMM IE. Don't WARN on this since this is not caused by a bug
    on the client's system.
    
    This aligns the condition of the WARNING in drv_conf_tx
    with the validity check in ieee80211_sta_wmm_params.
    We will now pick the default values whenever we get
    a zeroed WMM IE.
    
    This has been reported here:
    https://bugzilla.kernel.org/show_bug.cgi?id=199161
    
    Fixes: f409079bb678 ("mac80211: sanity check CW_min/CW_max towards driver")
    Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 02366eccf81feeeaf329bbfda3dcce86468566fd
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Dec 6 08:44:31 2018 +0000

    drm/i915/execlists: Apply a full mb before execution for Braswell
    
    commit cf66b8a0ba142fbd1bf10ac8f3ae92d1b0cb7b8f upstream.
    
    Braswell is really picky about having our writes posted to memory before
    we execute or else the GPU may see stale values. A wmb() is insufficient
    as it only ensures the writes are visible to other cores, we need a full
    mb() to ensure the writes are in memory and visible to the GPU.
    
    The most frequent failure in flushing before execution is that we see
    stale PTE values and execute the wrong pages.
    
    References: 987abd5c62f9 ("drm/i915/execlists: Force write serialisation into context image vs execution")
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
    Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20181206084431.9805-3-chris@chris-wilson.co.uk
    (cherry picked from commit 490b8c65b9db45896769e1095e78725775f47b3e)
    Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit af20483dbd7c2a01f7874191524fc0397b9d3bec
Author: Brian Norris <briannorris@chromium.org>
Date:   Wed Dec 5 10:16:57 2018 -0800

    Revert "drm/rockchip: Allow driver to be shutdown on reboot/kexec"
    
    commit 63238173b2faf3d6b85a416f1c69af6c7be2413f upstream.
    
    This reverts commit 7f3ef5dedb146e3d5063b6845781ad1bb59b92b5.
    
    It causes new warnings [1] on shutdown when running the Google Kevin or
    Scarlet (RK3399) boards under Chrome OS. Presumably our usage of DRM is
    different than what Marc and Heiko test.
    
    We're looking at a different approach (e.g., [2]) to replace this, but
    IMO the revert should be taken first, as it already propagated to
    -stable.
    
    [1] Report here:
    http://lkml.kernel.org/lkml/20181205030127.GA200921@google.com
    
    WARNING: CPU: 4 PID: 2035 at drivers/gpu/drm/drm_mode_config.c:477 drm_mode_config_cleanup+0x1c4/0x294
    ...
     Call trace:
      drm_mode_config_cleanup+0x1c4/0x294
      rockchip_drm_unbind+0x4c/0x8c
      component_master_del+0x88/0xb8
      rockchip_drm_platform_remove+0x2c/0x44
      rockchip_drm_platform_shutdown+0x20/0x2c
      platform_drv_shutdown+0x2c/0x38
      device_shutdown+0x164/0x1b8
      kernel_restart_prepare+0x40/0x48
      kernel_restart+0x20/0x68
    ...
     Memory manager not clean during takedown.
     WARNING: CPU: 4 PID: 2035 at drivers/gpu/drm/drm_mm.c:950 drm_mm_takedown+0x34/0x44
    ...
      drm_mm_takedown+0x34/0x44
      rockchip_drm_unbind+0x64/0x8c
      component_master_del+0x88/0xb8
      rockchip_drm_platform_remove+0x2c/0x44
      rockchip_drm_platform_shutdown+0x20/0x2c
      platform_drv_shutdown+0x2c/0x38
      device_shutdown+0x164/0x1b8
      kernel_restart_prepare+0x40/0x48
      kernel_restart+0x20/0x68
    ...
    
    [2] https://patchwork.kernel.org/patch/10556151/
        https://www.spinics.net/lists/linux-rockchip/msg21342.html
        [PATCH] drm/rockchip: shutdown drm subsystem on shutdown
    
    Fixes: 7f3ef5dedb14 ("drm/rockchip: Allow driver to be shutdown on reboot/kexec")
    Cc: Jeffy Chen <jeffy.chen@rock-chips.com>
    Cc: Robin Murphy <robin.murphy@arm.com>
    Cc: Vicente Bergas <vicencb@gmail.com>
    Cc: Marc Zyngier <marc.zyngier@arm.com>
    Cc: Heiko Stuebner <heiko@sntech.de>
    Cc: stable@vger.kernel.org
    Signed-off-by: Brian Norris <briannorris@chromium.org>
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20181205181657.177703-1-briannorris@chromium.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b0daf4e6324f5164f91d8b9fcb4530e2928faf00
Author: Radu Rendec <radu.rendec@gmail.com>
Date:   Tue Nov 27 22:20:48 2018 -0500

    powerpc/msi: Fix NULL pointer access in teardown code
    
    commit 78e7b15e17ac175e7eed9e21c6f92d03d3b0a6fa upstream.
    
    The arch_teardown_msi_irqs() function assumes that controller ops
    pointers were already checked in arch_setup_msi_irqs(), but this
    assumption is wrong: arch_teardown_msi_irqs() can be called even when
    arch_setup_msi_irqs() returns an error (-ENOSYS).
    
    This can happen in the following scenario:
      - msi_capability_init() calls pci_msi_setup_msi_irqs()
      - pci_msi_setup_msi_irqs() returns -ENOSYS
      - msi_capability_init() notices the error and calls free_msi_irqs()
      - free_msi_irqs() calls pci_msi_teardown_msi_irqs()
    
    This is easier to see when CONFIG_PCI_MSI_IRQ_DOMAIN is not set and
    pci_msi_setup_msi_irqs() and pci_msi_teardown_msi_irqs() are just
    aliases to arch_setup_msi_irqs() and arch_teardown_msi_irqs().
    
    The call to free_msi_irqs() upon pci_msi_setup_msi_irqs() failure
    seems legit, as it does additional cleanup; e.g.
    list_del(&entry->list) and kfree(entry) inside free_msi_irqs() do
    happen (MSI descriptors are allocated before pci_msi_setup_msi_irqs()
    is called and need to be cleaned up if that fails).
    
    Fixes: 6b2fd7efeb88 ("PCI/MSI/PPC: Remove arch_msi_check_device()")
    Cc: stable@vger.kernel.org # v3.18+
    Signed-off-by: Radu Rendec <radu.rendec@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 326c9e17c1202e820f221946e07d13cbf8c9f964
Author: Steven Rostedt (VMware) <rostedt@goodmis.org>
Date:   Mon Dec 10 23:58:01 2018 -0500

    tracing: Fix memory leak of instance function hash filters
    
    commit 2840f84f74035e5a535959d5f17269c69fa6edc5 upstream.
    
    The following commands will cause a memory leak:
    
     # cd /sys/kernel/tracing
     # mkdir instances/foo
     # echo schedule > instance/foo/set_ftrace_filter
     # rmdir instances/foo
    
    The reason is that the hashes that hold the filters to set_ftrace_filter and
    set_ftrace_notrace are not freed if they contain any data on the instance
    and the instance is removed.
    
    Found by kmemleak detector.
    
    Cc: stable@vger.kernel.org
    Fixes: 591dffdade9f ("ftrace: Allow for function tracing instance to filter functions")
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5e8e777a42e8ec993afc8cfd3464dee6a1fb1ced
Author: Steven Rostedt (VMware) <rostedt@goodmis.org>
Date:   Sun Dec 9 21:17:30 2018 -0500

    tracing: Fix memory leak in set_trigger_filter()
    
    commit 3cec638b3d793b7cacdec5b8072364b41caeb0e1 upstream.
    
    When create_event_filter() fails in set_trigger_filter(), the filter may
    still be allocated and needs to be freed. The caller expects the
    data->filter to be updated with the new filter, even if the new filter
    failed (we could add an error message by setting set_str parameter of
    create_event_filter(), but that's another update).
    
    But because the error would just exit, filter was left hanging and
    nothing could free it.
    
    Found by kmemleak detector.
    
    Cc: stable@vger.kernel.org
    Fixes: bac5fb97a173a ("tracing: Add and use generic set_trigger_filter() implementation")
    Reviewed-by: Tom Zanussi <tom.zanussi@linux.intel.com>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6c4fbbd96b3daa4fb9d3eef0cf8b22336c8739f9
Author: Lubomir Rintel <lkundrak@v3.sk>
Date:   Sun Dec 2 12:12:24 2018 +0100

    ARM: mmp/mmp2: fix cpu_is_mmp2() on mmp2-dt
    
    commit 76f4e2c3b6a560cdd7a75b87df543e04d05a9e5f upstream.
    
    cpu_is_mmp2() was equivalent to cpu_is_pj4(), wouldn't be correct for
    multiplatform kernels. Fix it by also considering mmp_chip_id, as is
    done for cpu_is_pxa168() and cpu_is_pxa910() above.
    
    Moreover, it is only available with CONFIG_CPU_MMP2 and thus doesn't work
    on DT-based MMP2 machines. Enable it on CONFIG_MACH_MMP2_DT too.
    
    Note: CONFIG_CPU_MMP2 is only used for machines that use board files
    instead of DT. It should perhaps be renamed. I'm not doing it now, because
    I don't have a better idea.
    
    Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
    Acked-by: Arnd Bergmann <arnd@arndb.de>
    Cc: stable@vger.kernel.org
    Signed-off-by: Olof Johansson <olof@lixom.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5c2590dc3e2520157ebb6e84a372578bc80118f7
Author: Aaro Koskinen <aaro.koskinen@iki.fi>
Date:   Tue Nov 20 01:14:00 2018 +0200

    MMC: OMAP: fix broken MMC on OMAP15XX/OMAP5910/OMAP310
    
    commit e8cde625bfe8a714a856e1366bcbb259d7346095 upstream.
    
    Since v2.6.22 or so there has been reports [1] about OMAP MMC being
    broken on OMAP15XX based hardware (OMAP5910 and OMAP310). The breakage
    seems to have been caused by commit 46a6730e3ff9 ("mmc-omap: Fix
    omap to use MMC_POWER_ON") that changed clock enabling to be done
    on MMC_POWER_ON. This can happen multiple times in a row, and on 15XX
    the hardware doesn't seem to like it and the MMC just stops responding.
    Fix by memorizing the power mode and do the init only when necessary.
    
    Before the patch (on Palm TE):
    
            mmc0: new SD card at address b368
            mmcblk0: mmc0:b368 SDC   977 MiB
            mmci-omap mmci-omap.0: command timeout (CMD18)
            mmci-omap mmci-omap.0: command timeout (CMD13)
            mmci-omap mmci-omap.0: command timeout (CMD13)
            mmci-omap mmci-omap.0: command timeout (CMD12) [x 6]
            mmci-omap mmci-omap.0: command timeout (CMD13) [x 6]
            mmcblk0: error -110 requesting status
            mmci-omap mmci-omap.0: command timeout (CMD8)
            mmci-omap mmci-omap.0: command timeout (CMD18)
            mmci-omap mmci-omap.0: command timeout (CMD13)
            mmci-omap mmci-omap.0: command timeout (CMD13)
            mmci-omap mmci-omap.0: command timeout (CMD12) [x 6]
            mmci-omap mmci-omap.0: command timeout (CMD13) [x 6]
            mmcblk0: error -110 requesting status
            mmcblk0: recovery failed!
            print_req_error: I/O error, dev mmcblk0, sector 0
            Buffer I/O error on dev mmcblk0, logical block 0, async page read
             mmcblk0: unable to read partition table
    
    After the patch:
    
            mmc0: new SD card at address b368
            mmcblk0: mmc0:b368 SDC   977 MiB
             mmcblk0: p1
    
    The patch is based on a fix and analysis done by Ladislav Michl.
    
    Tested on OMAP15XX/OMAP310 (Palm TE), OMAP1710 (Nokia 770)
    and OMAP2420 (Nokia N810).
    
    [1] https://marc.info/?t=123175197000003&r=1&w=2
    
    Fixes: 46a6730e3ff9 ("mmc-omap: Fix omap to use MMC_POWER_ON")
    Reported-by: Ladislav Michl <ladis@linux-mips.org>
    Reported-by: Andrzej Zaborowski <balrogg@gmail.com>
    Tested-by: Ladislav Michl <ladis@linux-mips.org>
    Acked-by: Tony Lindgren <tony@atomide.com>
    Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
    Cc: stable@vger.kernel.org
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3a7bac902691cd92cb69f95d98dc675dea8b3228
Author: Jeff Moyer <jmoyer@redhat.com>
Date:   Tue Dec 11 12:37:49 2018 -0500

    aio: fix spectre gadget in lookup_ioctx
    
    commit a538e3ff9dabcdf6c3f477a373c629213d1c3066 upstream.
    
    Matthew pointed out that the ioctx_table is susceptible to spectre v1,
    because the index can be controlled by an attacker.  The below patch
    should mitigate the attack for all of the aio system calls.
    
    Cc: stable@vger.kernel.org
    Reported-by: Matthew Wilcox <willy@infradead.org>
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4cf3b84a10eae6d6d9b6bd369b6906ae7532abd1
Author: Chen-Yu Tsai <wens@csie.org>
Date:   Tue Dec 4 17:04:57 2018 +0800

    pinctrl: sunxi: a83t: Fix IRQ offset typo for PH11
    
    commit 478b6767ad26ab86d9ecc341027dd09a87b1f997 upstream.
    
    Pin PH11 is used on various A83T board to detect a change in the OTG
    port's ID pin, as in when an OTG host cable is plugged in.
    
    The incorrect offset meant the gpiochip/irqchip was activating the wrong
    pin for interrupts.
    
    Fixes: 4730f33f0d82 ("pinctrl: sunxi: add allwinner A83T PIO controller support")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Chen-Yu Tsai <wens@csie.org>
    Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1098aad93c4a05a0165fd008e13be99201a9e621
Author: Ingo Molnar <mingo@kernel.org>
Date:   Mon Nov 13 07:15:41 2017 +0100

    timer/debug: Change /proc/timer_list from 0444 to 0400
    
    [ Upstream commit 8e7df2b5b7f245c9bd11064712db5cb69044a362 ]
    
    While it uses %pK, there's still few reasons to read this file
    as non-root.
    
    Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
    Acked-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 36c9eca096a72ba02df39d653ae7005825dce65a
Author: Davidlohr Bueso <dave@stgolabs.net>
Date:   Mon Jul 10 15:51:49 2017 -0700

    lib/interval_tree_test.c: allow users to limit scope of endpoint
    
    [ Upstream commit a8ec14d4f6aa8e245efacc992c8ee6ea0464ce2a ]
    
    Add a 'max_endpoint' parameter such that users may easily limit the size
    of the intervals that are randomly generated.
    
    Link: http://lkml.kernel.org/r/20170518174936.20265-4-dave@stgolabs.net
    Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c07f4060708d136071aeac63b8dd898233694812
Author: Davidlohr Bueso <dave@stgolabs.net>
Date:   Fri Nov 17 15:28:27 2017 -0800

    lib/rbtree-test: lower default params
    
    [ Upstream commit 0b548e33e6cb2bff240fdaf1783783be15c29080 ]
    
    Fengguang reported soft lockups while running the rbtree and interval
    tree test modules.  The logic for these tests all occur in init phase,
    and we currently are pounding with the default values for number of
    nodes and number of iterations of each test.  Reduce the latter by two
    orders of magnitude.  This does not influence the value of the tests in
    that one thousand times by default is enough to get the picture.
    
    Link: http://lkml.kernel.org/r/20171109161715.xai2dtwqw2frhkcm@linux-n805
    Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
    Reported-by: Fengguang Wu <fengguang.wu@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 <sashal@kernel.org>

commit b7d8b9cb820e74fe466ff0108893c08f28f3ebc1
Author: Davidlohr Bueso <dave@stgolabs.net>
Date:   Fri Sep 8 16:14:46 2017 -0700

    lib/rbtree_test.c: make input module parameters
    
    [ Upstream commit 223f8911eace60c787f8767c25148b80ece9732a ]
    
    Allows for more flexible debugging.
    
    Link: http://lkml.kernel.org/r/20170719014603.19029-5-dave@stgolabs.net
    Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5e03c490303c03a4f35e72f2209a79a19d954454
Author: Davidlohr Bueso <dave@stgolabs.net>
Date:   Mon Jul 10 15:51:52 2017 -0700

    lib/interval_tree_test.c: allow full tree search
    
    [ Upstream commit c46ecce431ebe6b1a9551d1f530eb432dae5c39b ]
    
    ...  such that a user can specify visiting all the nodes in the tree
    (intersects with the world).  This is a nice opposite from the very
    basic default query which is a single point.
    
    Link: http://lkml.kernel.org/r/20170518174936.20265-5-dave@stgolabs.net
    Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c114bdd5842b05f1d1079927074645b79edb6fc1
Author: Davidlohr Bueso <dave@stgolabs.net>
Date:   Mon Jul 10 15:51:46 2017 -0700

    lib/interval_tree_test.c: make test options module parameters
    
    [ Upstream commit a54dae0338b7f01eb0f9c7571fb9b74f791d1c6b ]
    
    Allows for more flexible debugging.
    
    Link: http://lkml.kernel.org/r/20170518174936.20265-3-dave@stgolabs.net
    Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1e7066a4540b39d475782122db60cf93633dca48
Author: Will Deacon <will.deacon@arm.com>
Date:   Wed Sep 5 15:34:42 2018 +0100

    signal: Introduce COMPAT_SIGMINSTKSZ for use in compat_sys_sigaltstack
    
    commit 22839869f21ab3850fbbac9b425ccc4c0023926f upstream.
    
    The sigaltstack(2) system call fails with -ENOMEM if the new alternative
    signal stack is found to be smaller than SIGMINSTKSZ. On architectures
    such as arm64, where the native value for SIGMINSTKSZ is larger than
    the compat value, this can result in an unexpected error being reported
    to a compat task. See, for example:
    
      https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=904385
    
    This patch fixes the problem by extending do_sigaltstack to take the
    minimum signal stack size as an additional parameter, allowing the
    native and compat system call entry code to pass in their respective
    values. COMPAT_SIGMINSTKSZ is just defined as SIGMINSTKSZ if it has not
    been defined by the architecture.
    
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Dominik Brodowski <linux@dominikbrodowski.net>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Reported-by: Steve McIntyre <steve.mcintyre@arm.com>
    Tested-by: Steve McIntyre <93sam@debian.org>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    [signal: Fix up cherry-pick conflicts for 22839869f21a]
    Signed-off-by: Steve McIntyre <93sam@debian.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>