commit ec822b3e8bf485ecb543773ad29289e6bb87b338
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sat Jan 9 13:37:40 2021 +0100

    Linux 4.14.214
    
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Link: https://lore.kernel.org/r/20210107143052.973437064@linuxfoundation.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d367530330f7f638eecdfc724ae276546f1b1e68
Author: Zhang Xiaohui <ruc_zhangxiaohui@163.com>
Date:   Sun Dec 6 16:48:01 2020 +0800

    mwifiex: Fix possible buffer overflows in mwifiex_cmd_802_11_ad_hoc_start
    
    [ Upstream commit 5c455c5ab332773464d02ba17015acdca198f03d ]
    
    mwifiex_cmd_802_11_ad_hoc_start() calls memcpy() without checking
    the destination size may trigger a buffer overflower,
    which a local user could use to cause denial of service
    or the execution of arbitrary code.
    Fix it by putting the length check before calling memcpy().
    
    Signed-off-by: Zhang Xiaohui <ruc_zhangxiaohui@163.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Link: https://lore.kernel.org/r/20201206084801.26479-1-ruc_zhangxiaohui@163.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit dce948280a43f22b48884005e42995356657dd14
Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Date:   Sun Sep 20 12:27:37 2020 +0100

    iio:magnetometer:mag3110: Fix alignment and data leak issues.
    
    commit 89deb1334252ea4a8491d47654811e28b0790364 upstream
    
    One of a class of bugs pointed out by Lars in a recent review.
    iio_push_to_buffers_with_timestamp() assumes the buffer used is aligned
    to the size of the timestamp (8 bytes).  This is not guaranteed in
    this driver which uses an array of smaller elements on the stack.
    As Lars also noted this anti pattern can involve a leak of data to
    userspace and that indeed can happen here.  We close both issues by
    moving to a suitable structure in the iio_priv() data.
    This data is allocated with kzalloc() so no data can leak apart from
    previous readings.
    
    The explicit alignment of ts is not necessary in this case but
    does make the code slightly less fragile so I have included it.
    
    Fixes: 39631b5f9584 ("iio: Add Freescale mag3110 magnetometer driver")
    Reported-by: Lars-Peter Clausen <lars@metafoo.de>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
    Cc: <Stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20200920112742.170751-4-jic23@kernel.org
    [sudip: adjust context]
    Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 92879e6e86bb8c6dbe25d601116ecfd21fc5605b
Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Date:   Sun Sep 20 12:27:39 2020 +0100

    iio:imu:bmi160: Fix alignment and data leak issues
    
    commit 7b6b51234df6cd8b04fe736b0b89c25612d896b8 upstream
    
    One of a class of bugs pointed out by Lars in a recent review.
    iio_push_to_buffers_with_timestamp assumes the buffer used is aligned
    to the size of the timestamp (8 bytes).  This is not guaranteed in
    this driver which uses an array of smaller elements on the stack.
    As Lars also noted this anti pattern can involve a leak of data to
    userspace and that indeed can happen here.  We close both issues by
    moving to a suitable array in the iio_priv() data with alignment
    explicitly requested.  This data is allocated with kzalloc() so no
    data can leak apart from previous readings.
    
    In this driver, depending on which channels are enabled, the timestamp
    can be in a number of locations.  Hence we cannot use a structure
    to specify the data layout without it being misleading.
    
    Fixes: 77c4ad2d6a9b ("iio: imu: Add initial support for Bosch BMI160")
    Reported-by: Lars-Peter Clausen <lars@metafoo.de>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
    Cc: Daniel Baluta  <daniel.baluta@gmail.com>
    Cc: Daniel Baluta <daniel.baluta@oss.nxp.com>
    Cc: <Stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20200920112742.170751-6-jic23@kernel.org
    [sudip: adjust context and use bmi160_data in old location]
    Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 72ffc8eb934c621c02739f871332b9c2dc3a13c1
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Tue Dec 29 15:14:55 2020 -0800

    kdev_t: always inline major/minor helper functions
    
    commit aa8c7db494d0a83ecae583aa193f1134ef25d506 upstream.
    
    Silly GCC doesn't always inline these trivial functions.
    
    Fixes the following warning:
    
      arch/x86/kernel/sys_ia32.o: warning: objtool: cp_stat64()+0xd8: call to new_encode_dev() with UACCESS enabled
    
    Link: https://lkml.kernel.org/r/984353b44a4484d86ba9f73884b7306232e25e30.1608737428.git.jpoimboe@redhat.com
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Reported-by: Randy Dunlap <rdunlap@infradead.org>
    Acked-by: Randy Dunlap <rdunlap@infradead.org>  [build-tested]
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.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 8147d77ad9baf80234c47bcaa033406f0e71c92f
Author: Hyeongseok Kim <hyeongseok@gmail.com>
Date:   Thu Dec 3 09:46:59 2020 +0900

    dm verity: skip verity work if I/O error when system is shutting down
    
    [ Upstream commit 252bd1256396cebc6fc3526127fdb0b317601318 ]
    
    If emergency system shutdown is called, like by thermal shutdown,
    a dm device could be alive when the block device couldn't process
    I/O requests anymore. In this state, the handling of I/O errors
    by new dm I/O requests or by those already in-flight can lead to
    a verity corruption state, which is a misjudgment.
    
    So, skip verity work in response to I/O error when system is shutting
    down.
    
    Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
    Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3f8c7a235a524343f2705196bba6c723b3a1fd98
Author: Takashi Iwai <tiwai@suse.de>
Date:   Fri Dec 18 15:56:25 2020 +0100

    ALSA: pcm: Clear the full allocated memory at hw_params
    
    [ Upstream commit 618de0f4ef11acd8cf26902e65493d46cc20cc89 ]
    
    The PCM hw_params core function tries to clear up the PCM buffer
    before actually using for avoiding the information leak from the
    previous usages or the usage before a new allocation.  It performs the
    memset() with runtime->dma_bytes, but this might still leave some
    remaining bytes untouched; namely, the PCM buffer size is aligned in
    page size for mmap, hence runtime->dma_bytes doesn't necessarily cover
    all PCM buffer pages, and the remaining bytes are exposed via mmap.
    
    This patch changes the memory clearance to cover the all buffer pages
    if the stream is supposed to be mmap-ready (that guarantees that the
    buffer size is aligned in page size).
    
    Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
    Link: https://lore.kernel.org/r/20201218145625.2045-3-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c4c670e1ea402b5657c5c4835f6669a5d39ee534
Author: Jessica Yu <jeyu@kernel.org>
Date:   Fri Nov 27 10:09:39 2020 +0100

    module: delay kobject uevent until after module init call
    
    [ Upstream commit 38dc717e97153e46375ee21797aa54777e5498f3 ]
    
    Apparently there has been a longstanding race between udev/systemd and
    the module loader. Currently, the module loader sends a uevent right
    after sysfs initialization, but before the module calls its init
    function. However, some udev rules expect that the module has
    initialized already upon receiving the uevent.
    
    This race has been triggered recently (see link in references) in some
    systemd mount unit files. For instance, the configfs module creates the
    /sys/kernel/config mount point in its init function, however the module
    loader issues the uevent before this happens. sys-kernel-config.mount
    expects to be able to mount /sys/kernel/config upon receipt of the
    module loading uevent, but if the configfs module has not called its
    init function yet, then this directory will not exist and the mount unit
    fails. A similar situation exists for sys-fs-fuse-connections.mount, as
    the fuse sysfs mount point is created during the fuse module's init
    function. If udev is faster than module initialization then the mount
    unit would fail in a similar fashion.
    
    To fix this race, delay the module KOBJ_ADD uevent until after the
    module has finished calling its init routine.
    
    References: https://github.com/systemd/systemd/issues/17586
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Tested-By: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
    Signed-off-by: Jessica Yu <jeyu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3569349e760c7903fd6990b835f64fdc98c016a8
Author: Qinglang Miao <miaoqinglang@huawei.com>
Date:   Wed Oct 28 17:15:51 2020 +0800

    powerpc: sysdev: add missing iounmap() on error in mpic_msgr_probe()
    
    [ Upstream commit ffa1797040c5da391859a9556be7b735acbe1242 ]
    
    I noticed that iounmap() of msgr_block_addr before return from
    mpic_msgr_probe() in the error handling case is missing. So use
    devm_ioremap() instead of just ioremap() when remapping the message
    register block, so the mapping will be automatically released on
    probe failure.
    
    Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20201028091551.136400-1-miaoqinglang@huawei.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 63b61ea7cd96652d250845d35c80b1aaa865503d
Author: Jan Kara <jack@suse.cz>
Date:   Mon Nov 2 16:32:10 2020 +0100

    quota: Don't overflow quota file offsets
    
    [ Upstream commit 10f04d40a9fa29785206c619f80d8beedb778837 ]
    
    The on-disk quota format supports quota files with upto 2^32 blocks. Be
    careful when computing quota file offsets in the quota files from block
    numbers as they can overflow 32-bit types. Since quota files larger than
    4GB would require ~26 millions of quota users, this is mostly a
    theoretical concern now but better be careful, fuzzers would find the
    problem sooner or later anyway...
    
    Reviewed-by: Andreas Dilger <adilger@dilger.ca>
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 22d29be48cef12cd97beac20bf0431a326847b02
Author: Miroslav Benes <mbenes@suse.cz>
Date:   Tue Oct 27 15:03:36 2020 +0100

    module: set MODULE_STATE_GOING state when a module fails to load
    
    [ Upstream commit 5e8ed280dab9eeabc1ba0b2db5dbe9fe6debb6b5 ]
    
    If a module fails to load due to an error in prepare_coming_module(),
    the following error handling in load_module() runs with
    MODULE_STATE_COMING in module's state. Fix it by correctly setting
    MODULE_STATE_GOING under "bug_cleanup" label.
    
    Signed-off-by: Miroslav Benes <mbenes@suse.cz>
    Signed-off-by: Jessica Yu <jeyu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3ce2fd56bb342f15cc2184ec321610546bfe6f26
Author: Dinghao Liu <dinghao.liu@zju.edu.cn>
Date:   Tue Oct 20 14:12:26 2020 +0800

    rtc: sun6i: Fix memleak in sun6i_rtc_clk_init
    
    [ Upstream commit 28d211919e422f58c1e6c900e5810eee4f1ce4c8 ]
    
    When clk_hw_register_fixed_rate_with_accuracy() fails,
    clk_data should be freed. It's the same for the subsequent
    two error paths, but we should also unregister the already
    registered clocks in them.
    
    Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Link: https://lore.kernel.org/r/20201020061226.6572-1-dinghao.liu@zju.edu.cn
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c5eae3edc5273ac59dab70fd49114cce729f27f4
Author: Takashi Iwai <tiwai@suse.de>
Date:   Sun Dec 6 09:34:56 2020 +0100

    ALSA: seq: Use bool for snd_seq_queue internal flags
    
    commit 4ebd47037027c4beae99680bff3b20fdee5d7c1e upstream.
    
    The snd_seq_queue struct contains various flags in the bit fields.
    Those are categorized to two different use cases, both of which are
    protected by different spinlocks.  That implies that there are still
    potential risks of the bad operations for bit fields by concurrent
    accesses.
    
    For addressing the problem, this patch rearranges those flags to be
    a standard bool instead of a bit field.
    
    Reported-by: syzbot+63cbe31877bb80ef58f5@syzkaller.appspotmail.com
    Link: https://lore.kernel.org/r/20201206083456.21110-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 63cd39aa6c7b514a2914934cf940d4c86305b699
Author: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Date:   Fri Nov 27 07:40:21 2020 +0100

    media: gp8psk: initialize stats at power control logic
    
    commit d0ac1a26ed5943127cb0156148735f5f52a07075 upstream.
    
    As reported on:
            https://lore.kernel.org/linux-media/20190627222020.45909-1-willemdebruijn.kernel@gmail.com/
    
    if gp8psk_usb_in_op() returns an error, the status var is not
    initialized. Yet, this var is used later on, in order to
    identify:
            - if the device was already started;
            - if firmware has loaded;
            - if the LNBf was powered on.
    
    Using status = 0 seems to ensure that everything will be
    properly powered up.
    
    So, instead of the proposed solution, let's just set
    status = 0.
    
    Reported-by: syzbot <syzkaller@googlegroups.com>
    Reported-by: Willem de Bruijn <willemb@google.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 68d8414711b4e392fba64b1dd567dedaeb10deb8
Author: Anant Thazhemadam <anant.thazhemadam@gmail.com>
Date:   Mon Nov 23 04:15:34 2020 +0530

    misc: vmw_vmci: fix kernel info-leak by initializing dbells in vmci_ctx_get_chkpt_doorbells()
    
    commit 31dcb6c30a26d32650ce134820f27de3c675a45a upstream.
    
    A kernel-infoleak was reported by syzbot, which was caused because
    dbells was left uninitialized.
    Using kzalloc() instead of kmalloc() fixes this issue.
    
    Reported-by: syzbot+a79e17c39564bedf0930@syzkaller.appspotmail.com
    Tested-by: syzbot+a79e17c39564bedf0930@syzkaller.appspotmail.com
    Signed-off-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>
    Link: https://lore.kernel.org/r/20201122224534.333471-1-anant.thazhemadam@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b74d5f70523a819aac71e0eee4f4b530e69e463a
Author: Rustam Kovhaev <rkovhaev@gmail.com>
Date:   Sun Nov 1 06:09:58 2020 -0800

    reiserfs: add check for an invalid ih_entry_count
    
    commit d24396c5290ba8ab04ba505176874c4e04a2d53c upstream.
    
    when directory item has an invalid value set for ih_entry_count it might
    trigger use-after-free or out-of-bounds read in bin_search_in_dir_item()
    
    ih_entry_count * IH_SIZE for directory item should not be larger than
    ih_item_len
    
    Link: https://lore.kernel.org/r/20201101140958.3650143-1-rkovhaev@gmail.com
    Reported-and-tested-by: syzbot+83b6f7cf9922cae5c4d7@syzkaller.appspotmail.com
    Link: https://syzkaller.appspot.com/bug?extid=83b6f7cf9922cae5c4d7
    Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com>
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 320f61926b081865181de2d7edd18f1d06c4e600
Author: Johan Hovold <johan@kernel.org>
Date:   Mon Nov 23 11:23:12 2020 +0100

    of: fix linker-section match-table corruption
    
    commit 5812b32e01c6d86ba7a84110702b46d8a8531fe9 upstream.
    
    Specify type alignment when declaring linker-section match-table entries
    to prevent gcc from increasing alignment and corrupting the various
    tables with padding (e.g. timers, irqchips, clocks, reserved memory).
    
    This is specifically needed on x86 where gcc (typically) aligns larger
    objects like struct of_device_id with static extent on 32-byte
    boundaries which at best prevents matching on anything but the first
    entry. Specifying alignment when declaring variables suppresses this
    optimisation.
    
    Here's a 64-bit example where all entries are corrupt as 16 bytes of
    padding has been inserted before the first entry:
    
            ffffffff8266b4b0 D __clk_of_table
            ffffffff8266b4c0 d __of_table_fixed_factor_clk
            ffffffff8266b5a0 d __of_table_fixed_clk
            ffffffff8266b680 d __clk_of_table_sentinel
    
    And here's a 32-bit example where the 8-byte-aligned table happens to be
    placed on a 32-byte boundary so that all but the first entry are corrupt
    due to the 28 bytes of padding inserted between entries:
    
            812b3ec0 D __irqchip_of_table
            812b3ec0 d __of_table_irqchip1
            812b3fa0 d __of_table_irqchip2
            812b4080 d __of_table_irqchip3
            812b4160 d irqchip_of_match_end
    
    Verified on x86 using gcc-9.3 and gcc-4.9 (which uses 64-byte
    alignment), and on arm using gcc-7.2.
    
    Note that there are no in-tree users of these tables on x86 currently
    (even if they are included in the image).
    
    Fixes: 54196ccbe0ba ("of: consolidate linker section OF match table declarations")
    Fixes: f6e916b82022 ("irqchip: add basic infrastructure")
    Cc: stable <stable@vger.kernel.org>     # 3.9
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://lore.kernel.org/r/20201123102319.8090-2-johan@kernel.org
    [ johan: adjust context to 5.4 ]
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b732e14e6218bd925e15c539165f037081ae5176
Author: Petr Vorel <petr.vorel@gmail.com>
Date:   Mon Dec 14 19:03:21 2020 -0800

    uapi: move constants from <linux/kernel.h> to <linux/const.h>
    
    commit a85cbe6159ffc973e5702f70a3bd5185f8f3c38d upstream.
    
    and include <linux/const.h> in UAPI headers instead of <linux/kernel.h>.
    
    The reason is to avoid indirect <linux/sysinfo.h> include when using
    some network headers: <linux/netlink.h> or others -> <linux/kernel.h>
    -> <linux/sysinfo.h>.
    
    This indirect include causes on MUSL redefinition of struct sysinfo when
    included both <sys/sysinfo.h> and some of UAPI headers:
    
        In file included from x86_64-buildroot-linux-musl/sysroot/usr/include/linux/kernel.h:5,
                         from x86_64-buildroot-linux-musl/sysroot/usr/include/linux/netlink.h:5,
                         from ../include/tst_netlink.h:14,
                         from tst_crypto.c:13:
        x86_64-buildroot-linux-musl/sysroot/usr/include/linux/sysinfo.h:8:8: error: redefinition of `struct sysinfo'
         struct sysinfo {
                ^~~~~~~
        In file included from ../include/tst_safe_macros.h:15,
                         from ../include/tst_test.h:93,
                         from tst_crypto.c:11:
        x86_64-buildroot-linux-musl/sysroot/usr/include/sys/sysinfo.h:10:8: note: originally defined here
    
    Link: https://lkml.kernel.org/r/20201015190013.8901-1-petr.vorel@gmail.com
    Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
    Suggested-by: Rich Felker <dalias@aerifal.cx>
    Acked-by: Rich Felker <dalias@libc.org>
    Cc: Peter Korsgaard <peter@korsgaard.com>
    Cc: Baruch Siach <baruch@tkos.co.il>
    Cc: Florian Weimer <fweimer@redhat.com>
    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 404653452c4382236f0ff57f88a2dbad668f8ed7
Author: Christophe Leroy <christophe.leroy@csgroup.eu>
Date:   Thu Oct 22 14:05:46 2020 +0000

    powerpc/bitops: Fix possible undefined behaviour with fls() and fls64()
    
    [ Upstream commit 1891ef21d92c4801ea082ee8ed478e304ddc6749 ]
    
    fls() and fls64() are using __builtin_ctz() and _builtin_ctzll().
    On powerpc, those builtins trivially use ctlzw and ctlzd power
    instructions.
    
    Allthough those instructions provide the expected result with
    input argument 0, __builtin_ctz() and __builtin_ctzll() are
    documented as undefined for value 0.
    
    The easiest fix would be to use fls() and fls64() functions
    defined in include/asm-generic/bitops/builtin-fls.h and
    include/asm-generic/bitops/fls64.h, but GCC output is not optimal:
    
    00000388 <testfls>:
     388:   2c 03 00 00     cmpwi   r3,0
     38c:   41 82 00 10     beq     39c <testfls+0x14>
     390:   7c 63 00 34     cntlzw  r3,r3
     394:   20 63 00 20     subfic  r3,r3,32
     398:   4e 80 00 20     blr
     39c:   38 60 00 00     li      r3,0
     3a0:   4e 80 00 20     blr
    
    000003b0 <testfls64>:
     3b0:   2c 03 00 00     cmpwi   r3,0
     3b4:   40 82 00 1c     bne     3d0 <testfls64+0x20>
     3b8:   2f 84 00 00     cmpwi   cr7,r4,0
     3bc:   38 60 00 00     li      r3,0
     3c0:   4d 9e 00 20     beqlr   cr7
     3c4:   7c 83 00 34     cntlzw  r3,r4
     3c8:   20 63 00 20     subfic  r3,r3,32
     3cc:   4e 80 00 20     blr
     3d0:   7c 63 00 34     cntlzw  r3,r3
     3d4:   20 63 00 40     subfic  r3,r3,64
     3d8:   4e 80 00 20     blr
    
    When the input of fls(x) is a constant, just check x for nullity and
    return either 0 or __builtin_clz(x). Otherwise, use cntlzw instruction
    directly.
    
    For fls64() on PPC64, do the same but with __builtin_clzll() and
    cntlzd instruction. On PPC32, lets take the generic fls64() which
    will use our fls(). The result is as expected:
    
    00000388 <testfls>:
     388:   7c 63 00 34     cntlzw  r3,r3
     38c:   20 63 00 20     subfic  r3,r3,32
     390:   4e 80 00 20     blr
    
    000003a0 <testfls64>:
     3a0:   2c 03 00 00     cmpwi   r3,0
     3a4:   40 82 00 10     bne     3b4 <testfls64+0x14>
     3a8:   7c 83 00 34     cntlzw  r3,r4
     3ac:   20 63 00 20     subfic  r3,r3,32
     3b0:   4e 80 00 20     blr
     3b4:   7c 63 00 34     cntlzw  r3,r3
     3b8:   20 63 00 40     subfic  r3,r3,64
     3bc:   4e 80 00 20     blr
    
    Fixes: 2fcff790dcb4 ("powerpc: Use builtin functions for fls()/__fls()/fls64()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Acked-by: Segher Boessenkool <segher@kernel.crashing.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/348c2d3f19ffcff8abe50d52513f989c4581d000.1603375524.git.christophe.leroy@csgroup.eu
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5603bcc51324476bafd4bf4112857d93b4909993
Author: Johan Hovold <johan@kernel.org>
Date:   Mon Oct 26 11:43:06 2020 +0100

    USB: serial: digi_acceleport: fix write-wakeup deadlocks
    
    [ Upstream commit 5098e77962e7c8947f87bd8c5869c83e000a522a ]
    
    The driver must not call tty_wakeup() while holding its private lock as
    line disciplines are allowed to call back into write() from
    write_wakeup(), leading to a deadlock.
    
    Also remove the unneeded work struct that was used to defer wakeup in
    order to work around a possible race in ancient times (see comment about
    n_tty write_chan() in commit 14b54e39b412 ("USB: serial: remove
    changelogs and old todo entries")).
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 80a49c5756911d0c3ca3177225ae917697de4326
Author: Stefan Haberland <sth@linux.ibm.com>
Date:   Thu Dec 17 16:59:04 2020 +0100

    s390/dasd: fix hanging device offline processing
    
    [ Upstream commit 658a337a606f48b7ebe451591f7681d383fa115e ]
    
    For an LCU update a read unit address configuration IO is required.
    This is started using sleep_on(), which has early exit paths in case the
    device is not usable for IO. For example when it is in offline processing.
    
    In those cases the LCU update should fail and not be retried.
    Therefore lcu_update_work checks if EOPNOTSUPP is returned or not.
    
    Commit 41995342b40c ("s390/dasd: fix endless loop after read unit address configuration")
    accidentally removed the EOPNOTSUPP return code from
    read_unit_address_configuration(), which in turn might lead to an endless
    loop of the LCU update in offline processing.
    
    Fix by returning EOPNOTSUPP again if the device is not able to perform the
    request.
    
    Fixes: 41995342b40c ("s390/dasd: fix endless loop after read unit address configuration")
    Cc: stable@vger.kernel.org #5.3
    Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
    Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6e1278ea35099542b2e5b7c6adb3a0cdfb590d47
Author: Eric Auger <eric.auger@redhat.com>
Date:   Fri Nov 13 18:52:02 2020 +0100

    vfio/pci: Move dummy_resources_list init in vfio_pci_probe()
    
    [ Upstream commit 16b8fe4caf499ae8e12d2ab1b1324497e36a7b83 ]
    
    In case an error occurs in vfio_pci_enable() before the call to
    vfio_pci_probe_mmaps(), vfio_pci_disable() will  try to iterate
    on an uninitialized list and cause a kernel panic.
    
    Lets move to the initialization to vfio_pci_probe() to fix the
    issue.
    
    Signed-off-by: Eric Auger <eric.auger@redhat.com>
    Fixes: 05f0c03fbac1 ("vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive")
    CC: Stable <stable@vger.kernel.org> # v4.7+
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit aa93e9471afe103812badfd10be6509554312e72
Author: Johannes Weiner <hannes@cmpxchg.org>
Date:   Tue Dec 29 02:38:22 2020 +0000

    mm: memcontrol: fix excessive complexity in memory.stat reporting
    
    commit a983b5ebee57209c99f68c8327072f25e0e6e3da upstream
    
    We've seen memory.stat reads in top-level cgroups take up to fourteen
    seconds during a userspace bug that created tens of thousands of ghost
    cgroups pinned by lingering page cache.
    
    Even with a more reasonable number of cgroups, aggregating memory.stat
    is unnecessarily heavy.  The complexity is this:
    
            nr_cgroups * nr_stat_items * nr_possible_cpus
    
    where the stat items are ~70 at this point.  With 128 cgroups and 128
    CPUs - decent, not enormous setups - reading the top-level memory.stat
    has to aggregate over a million per-cpu counters.  This doesn't scale.
    
    Instead of spreading the source of truth across all CPUs, use the
    per-cpu counters merely to batch updates to shared atomic counters.
    
    This is the same as the per-cpu stocks we use for charging memory to the
    shared atomic page_counters, and also the way the global vmstat counters
    are implemented.
    
    Vmstat has elaborate spilling thresholds that depend on the number of
    CPUs, amount of memory, and memory pressure - carefully balancing the
    cost of counter updates with the amount of per-cpu error.  That's
    because the vmstat counters are system-wide, but also used for decisions
    inside the kernel (e.g.  NR_FREE_PAGES in the allocator).  Neither is
    true for the memory controller.
    
    Use the same static batch size we already use for page_counter updates
    during charging.  The per-cpu error in the stats will be 128k, which is
    an acceptable ratio of cores to memory accounting granularity.
    
    [hannes@cmpxchg.org: fix warning in __this_cpu_xchg() calls]
      Link: http://lkml.kernel.org/r/20171201135750.GB8097@cmpxchg.org
    Link: http://lkml.kernel.org/r/20171103153336.24044-3-hannes@cmpxchg.org
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    Acked-by: Vladimir Davydov <vdavydov.dev@gmail.com>
    Cc: Michal Hocko <mhocko@suse.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: stable@vger.kernel.org
    [shaoyi@amazon.com: resolved the conflict brought by commit 17ffa29c355658c8e9b19f56cbf0388500ca7905 in mm/memcontrol.c by contextual fix]
    Signed-off-by: Shaoying Xu <shaoyi@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 955f8bc9eb69b3be9a7785015c726f7004ec36b9
Author: Johannes Weiner <hannes@cmpxchg.org>
Date:   Tue Dec 29 02:35:58 2020 +0000

    mm: memcontrol: implement lruvec stat functions on top of each other
    
    commit 284542656e22c43fdada8c8cc0ca9ede8453eed7 upstream
    
    The implementation of the lruvec stat functions and their variants for
    accounting through a page, or accounting from a preemptible context, are
    mostly identical and needlessly repetitive.
    
    Implement the lruvec_page functions by looking up the page's lruvec and
    then using the lruvec function.
    
    Implement the functions for preemptible contexts by disabling preemption
    before calling the atomic context functions.
    
    Link: http://lkml.kernel.org/r/20171103153336.24044-2-hannes@cmpxchg.org
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    Acked-by: Vladimir Davydov <vdavydov.dev@gmail.com>
    Cc: Michal Hocko <mhocko@suse.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Shaoying Xu <shaoyi@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fdcda71d87acfe8f645f3ce5e9303688cad8b8f1
Author: Johannes Weiner <hannes@cmpxchg.org>
Date:   Tue Dec 29 02:33:42 2020 +0000

    mm: memcontrol: eliminate raw access to stat and event counters
    
    commit c9019e9bf42e66d028d70d2da6206cad4dd9250d upstream
    
    Replace all raw 'this_cpu_' modifications of the stat and event per-cpu
    counters with API functions such as mod_memcg_state().
    
    This makes the code easier to read, but is also in preparation for the
    next patch, which changes the per-cpu implementation of those counters.
    
    Link: http://lkml.kernel.org/r/20171103153336.24044-1-hannes@cmpxchg.org
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    Acked-by: Vladimir Davydov <vdavydov.dev@gmail.com>
    Cc: Michal Hocko <mhocko@suse.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Shaoying Xu <shaoyi@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f8181d33515448cf8e2c80b1307775b0b857f8cd
Author: Johan Hovold <johan@kernel.org>
Date:   Tue Jan 14 09:39:53 2020 +0100

    ALSA: usb-audio: fix sync-ep altsetting sanity check
    
    commit 5d1b71226dc4d44b4b65766fa9d74492f9d4587b upstream
    
    The altsetting sanity check in set_sync_ep_implicit_fb_quirk() was
    checking for there to be at least one altsetting but then went on to
    access the second one, which may not exist.
    
    This could lead to random slab data being used to initialise the sync
    endpoint in snd_usb_add_endpoint().
    
    Fixes: c75a8a7ae565 ("ALSA: snd-usb: add support for implicit feedback")
    Fixes: ca10a7ebdff1 ("ALSA: usb-audio: FT C400 sync playback EP to capture EP")
    Fixes: 5e35dc0338d8 ("ALSA: usb-audio: add implicit fb quirk for Behringer UFX1204")
    Fixes: 17f08b0d9aaf ("ALSA: usb-audio: add implicit fb quirk for Axe-Fx II")
    Fixes: 103e9625647a ("ALSA: usb-audio: simplify set_sync_ep_implicit_fb_quirk")
    Cc: stable <stable@vger.kernel.org>     # 3.5
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://lore.kernel.org/r/20200114083953.1106-1-johan@kernel.org
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 832cf724c1c92ea421df941e95bcf1c41e1e0c31
Author: Alberto Aguirre <albaguirre@gmail.com>
Date:   Wed Apr 18 09:35:34 2018 -0500

    ALSA: usb-audio: simplify set_sync_ep_implicit_fb_quirk
    
    commit 103e9625647ad74d201e26fb74afcd8479142a37 upstream
    
    Signed-off-by: Alberto Aguirre <albaguirre@gmail.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9695121abf9bb3082832d48872bf5533cd893ccd
Author: Takashi Iwai <tiwai@suse.de>
Date:   Fri Dec 13 09:51:11 2019 +0100

    ALSA: hda/ca0132 - Fix work handling in delayed HP detection
    
    commit 42fb6b1d41eb5905d77c06cad2e87b70289bdb76 upstream
    
    CA0132 has the delayed HP jack detection code that is invoked from the
    unsol handler, but it does a few weird things: it contains the cancel
    of a work inside the work handler, and yet it misses the cancel-sync
    call at (runtime-)suspend.  This patch addresses those issues.
    
    Fixes: 15c2b3cc09a3 ("ALSA: hda/ca0132 - Fix possible workqueue stall")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20191213085111.22855-4-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    [sudip: adjust context]
    Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fc299d4a5ffcb98f79394b456e4cc7d4490aadeb
Author: Kevin Vigor <kvigor@gmail.com>
Date:   Fri Nov 6 14:20:34 2020 -0800

    md/raid10: initialize r10_bio->read_slot before use.
    
    commit 93decc563637c4288380912eac0eb42fb246cc04 upstream.
    
    In __make_request() a new r10bio is allocated and passed to
    raid10_read_request(). The read_slot member of the bio is not
    initialized, and the raid10_read_request() uses it to index an
    array. This leads to occasional panics.
    
    Fix by initializing the field to invalid value and checking for
    valid value in raid10_read_request().
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Kevin Vigor <kvigor@gmail.com>
    Signed-off-by: Song Liu <songliubraving@fb.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ae48c9dd993908b24c40d6cb877d6a20abff9ad2
Author: Jan Beulich <JBeulich@suse.com>
Date:   Mon Feb 26 04:11:21 2018 -0700

    x86/entry/64: Add instruction suffix
    
    commit a368d7fd2a3c6babb852fe974018dd97916bcd3b upstream.
    
    Omitting suffixes from instructions in AT&T mode is bad practice when
    operand size cannot be determined by the assembler from register
    operands, and is likely going to be warned about by upstream gas in the
    future (mine does already). Add the single missing suffix here.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lkml.kernel.org/r/5A93F96902000078001ABAC8@prv-mh.provo.novell.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>