24 Feb, 2020

40 commits

  • [ Upstream commit 9f16ca48fc818a17de8be1f75d08e7f4addc4497 ]

    I found a NULL pointer dereference in ocfs2_update_inode_fsync_trans(),
    handle->h_transaction may be NULL in this situation:

    ocfs2_file_write_iter
    ->__generic_file_write_iter
    ->generic_perform_write
    ->ocfs2_write_begin
    ->ocfs2_write_begin_nolock
    ->ocfs2_write_cluster_by_desc
    ->ocfs2_write_cluster
    ->ocfs2_mark_extent_written
    ->ocfs2_change_extent_flag
    ->ocfs2_split_extent
    ->ocfs2_try_to_merge_extent
    ->ocfs2_extend_rotate_transaction
    ->ocfs2_extend_trans
    ->jbd2_journal_restart
    ->jbd2__journal_restart
    // handle->h_transaction is NULL here
    ->handle->h_transaction = NULL;
    ->start_this_handle
    /* journal aborted due to storage
    network disconnection, return error */
    ->return -EROFS;
    /* line 3806 in ocfs2_try_to_merge_extent (),
    it will ignore ret error. */
    ->ret = 0;
    ->...
    ->ocfs2_write_end
    ->ocfs2_write_end_nolock
    ->ocfs2_update_inode_fsync_trans
    // NULL pointer dereference
    ->oi->i_sync_tid = handle->h_transaction->t_tid;

    The information of NULL pointer dereference as follows:
    JBD2: Detected IO errors while flushing file data on dm-11-45
    Aborting journal on device dm-11-45.
    JBD2: Error -5 detected when updating journal superblock for dm-11-45.
    (dd,22081,3):ocfs2_extend_trans:474 ERROR: status = -30
    (dd,22081,3):ocfs2_try_to_merge_extent:3877 ERROR: status = -30
    Unable to handle kernel NULL pointer dereference at
    virtual address 0000000000000008
    Mem abort info:
    ESR = 0x96000004
    Exception class = DABT (current EL), IL = 32 bits
    SET = 0, FnV = 0
    EA = 0, S1PTW = 0
    Data abort info:
    ISV = 0, ISS = 0x00000004
    CM = 0, WnR = 0
    user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000e74e1338
    [0000000000000008] pgd=0000000000000000
    Internal error: Oops: 96000004 [#1] SMP
    Process dd (pid: 22081, stack limit = 0x00000000584f35a9)
    CPU: 3 PID: 22081 Comm: dd Kdump: loaded
    Hardware name: Huawei TaiShan 2280 V2/BC82AMDD, BIOS 0.98 08/25/2019
    pstate: 60400009 (nZCv daif +PAN -UAO)
    pc : ocfs2_write_end_nolock+0x2b8/0x550 [ocfs2]
    lr : ocfs2_write_end_nolock+0x2a0/0x550 [ocfs2]
    sp : ffff0000459fba70
    x29: ffff0000459fba70 x28: 0000000000000000
    x27: ffff807ccf7f1000 x26: 0000000000000001
    x25: ffff807bdff57970 x24: ffff807caf1d4000
    x23: ffff807cc79e9000 x22: 0000000000001000
    x21: 000000006c6cd000 x20: ffff0000091d9000
    x19: ffff807ccb239db0 x18: ffffffffffffffff
    x17: 000000000000000e x16: 0000000000000007
    x15: ffff807c5e15bd78 x14: 0000000000000000
    x13: 0000000000000000 x12: 0000000000000000
    x11: 0000000000000000 x10: 0000000000000001
    x9 : 0000000000000228 x8 : 000000000000000c
    x7 : 0000000000000fff x6 : ffff807a308ed6b0
    x5 : ffff7e01f10967c0 x4 : 0000000000000018
    x3 : d0bc661572445600 x2 : 0000000000000000
    x1 : 000000001b2e0200 x0 : 0000000000000000
    Call trace:
    ocfs2_write_end_nolock+0x2b8/0x550 [ocfs2]
    ocfs2_write_end+0x4c/0x80 [ocfs2]
    generic_perform_write+0x108/0x1a8
    __generic_file_write_iter+0x158/0x1c8
    ocfs2_file_write_iter+0x668/0x950 [ocfs2]
    __vfs_write+0x11c/0x190
    vfs_write+0xac/0x1c0
    ksys_write+0x6c/0xd8
    __arm64_sys_write+0x24/0x30
    el0_svc_common+0x78/0x130
    el0_svc_handler+0x38/0x78
    el0_svc+0x8/0xc

    To prevent NULL pointer dereference in this situation, we use
    is_handle_aborted() before using handle->h_transaction->t_tid.

    Link: http://lkml.kernel.org/r/03e750ab-9ade-83aa-b000-b9e81e34e539@huawei.com
    Signed-off-by: Yan Wang
    Reviewed-by: Jun Piao
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Joseph Qi
    Cc: Changwei Ge
    Cc: Gang He
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    wangyan
     
  • [ Upstream commit ca322fb6030956c2337fbf1c1beeb08c5dd5c943 ]

    Gang He reports the failure of building fs/ocfs2/ as an external module
    of the kernel installed on the system:

    $ cd fs/ocfs2
    $ make -C /lib/modules/`uname -r`/build M=`pwd` modules

    If you want to make it work reliably, I'd recommend to remove ccflags-y
    from the Makefiles, and to make header paths relative to the C files. I
    think this is the correct usage of the #include "..." directive.

    Link: http://lkml.kernel.org/r/20191227022950.14804-1-ghe@suse.com
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Gang He
    Reported-by: Gang He
    Reviewed-by: Gang He
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Joseph Qi
    Cc: Changwei Ge
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Masahiro Yamada
     
  • [ Upstream commit f4b1363cae43fef7c86c993b7ca7fe7d546b3c68 ]

    We ran into a deadlock in production with the fixup worker. The stack
    traces were as follows:

    Thread responsible for the writeout, waiting on the page lock

    [] io_schedule+0x12/0x40
    [] __lock_page+0x109/0x1e0
    [] extent_write_cache_pages+0x206/0x360
    [] extent_writepages+0x40/0x60
    [] do_writepages+0x31/0xb0
    [] __writeback_single_inode+0x3d/0x350
    [] writeback_sb_inodes+0x19d/0x3c0
    [] __writeback_inodes_wb+0x5d/0xb0
    [] wb_writeback+0x231/0x2c0
    [] wb_workfn+0x308/0x3c0
    [] process_one_work+0x1e0/0x390
    [] worker_thread+0x2b/0x3c0
    [] kthread+0x113/0x130
    [] ret_from_fork+0x35/0x40
    [] 0xffffffffffffffff

    Thread of the fixup worker who is holding the page lock

    [] start_delalloc_inodes+0x241/0x2d0
    [] btrfs_start_delalloc_roots+0x179/0x230
    [] btrfs_alloc_data_chunk_ondemand+0x11b/0x2e0
    [] btrfs_check_data_free_space+0x53/0xa0
    [] btrfs_delalloc_reserve_space+0x20/0x70
    [] btrfs_writepage_fixup_worker+0x1fc/0x2a0
    [] normal_work_helper+0x11c/0x360
    [] process_one_work+0x1e0/0x390
    [] worker_thread+0x2b/0x3c0
    [] kthread+0x113/0x130
    [] ret_from_fork+0x35/0x40
    [] 0xffffffffffffffff

    Thankfully the stars have to align just right to hit this. First you
    have to end up in the fixup worker, which is tricky by itself (my
    reproducer does DIO reads into a MMAP'ed region, so not a common
    operation). Then you have to have less than a page size of free data
    space and 0 unallocated space so you go down the "commit the transaction
    to free up pinned space" path. This was accomplished by a random
    balance that was running on the host. Then you get this deadlock.

    I'm still in the process of trying to force the deadlock to happen on
    demand, but I've hit other issues. I can still trigger the fixup worker
    path itself so this patch has been tested in that regard, so the normal
    case is fine.

    Fixes: 87826df0ec36 ("btrfs: delalloc for page dirtied out-of-band in fixup worker")
    Signed-off-by: Josef Bacik
    Reviewed-by: David Sterba
    Signed-off-by: David Sterba
    Signed-off-by: Sasha Levin

    Josef Bacik
     
  • [ Upstream commit 43e76cd368fbb67e767da5363ffeaa3989993c8c ]

    Commit 8580ac9404f6 ("bpf: Process in-kernel BTF") introduced two weak
    symbols that may be unresolved at link time which result in an absolute
    relocation to 0. relocs_check.sh emits the following warning:

    "WARNING: 2 bad relocations
    c000000001a41478 R_PPC64_ADDR64 _binary__btf_vmlinux_bin_start
    c000000001a41480 R_PPC64_ADDR64 _binary__btf_vmlinux_bin_end"

    whereas those relocations are legitimate even for a relocatable kernel
    compiled with -pie option.

    relocs_check.sh already excluded some weak unresolved symbols explicitly:
    remove those hardcoded symbols and add some logic that parses the symbols
    using nm, retrieves all the weak unresolved symbols and excludes those from
    the list of the potential bad relocations.

    Reported-by: Stephen Rothwell
    Signed-off-by: Alexandre Ghiti
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200118170335.21440-1-alex@ghiti.fr
    Signed-off-by: Sasha Levin

    Alexandre Ghiti
     
  • [ Upstream commit ec3d65082d7dabad6fa8f66a8ef166f2d522d6b2 ]

    Per at least one tester this is enough magic to recover the regression
    introduced for some people (but not all) in

    commit b8e2b0199cc377617dc238f5106352c06dcd3fa2
    Author: Peter Rosin
    Date: Tue Jul 4 12:36:57 2017 +0200

    drm/fb-helper: factor out pseudo-palette

    which for radeon had the side-effect of refactoring out a seemingly
    redudant writing of the color palette.

    10ms in a fairly slow modeset path feels like an acceptable form of
    duct-tape, so maybe worth a shot and see what sticks.

    Cc: Alex Deucher
    Cc: Michel Dänzer
    References: https://bugzilla.kernel.org/show_bug.cgi?id=198123
    Signed-off-by: Daniel Vetter
    Signed-off-by: Alex Deucher
    Signed-off-by: Sasha Levin

    Daniel Vetter
     
  • [ Upstream commit 6722b23e7a2ace078344064a9735fb73e554e9ef ]

    if seq_file .next fuction does not change position index,
    read after some lseek can generate unexpected output.

    Without patch:
    # dd bs=30 skip=1 if=/sys/kernel/tracing/events/sched/sched_switch/trigger
    dd: /sys/kernel/tracing/events/sched/sched_switch/trigger: cannot skip to specified offset
    n traceoff snapshot stacktrace enable_event disable_event enable_hist disable_hist hist
    # Available triggers:
    # traceon traceoff snapshot stacktrace enable_event disable_event enable_hist disable_hist hist
    6+1 records in
    6+1 records out
    206 bytes copied, 0.00027916 s, 738 kB/s

    Notice the printing of "# Available triggers:..." after the line.

    With the patch:
    # dd bs=30 skip=1 if=/sys/kernel/tracing/events/sched/sched_switch/trigger
    dd: /sys/kernel/tracing/events/sched/sched_switch/trigger: cannot skip to specified offset
    n traceoff snapshot stacktrace enable_event disable_event enable_hist disable_hist hist
    2+1 records in
    2+1 records out
    88 bytes copied, 0.000526867 s, 167 kB/s

    It only prints the end of the file, and does not restart.

    Link: http://lkml.kernel.org/r/3c35ee24-dd3a-8119-9c19-552ed253388a@virtuozzo.com

    https://bugzilla.kernel.org/show_bug.cgi?id=206283
    Signed-off-by: Vasily Averin
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Sasha Levin

    Vasily Averin
     
  • [ Upstream commit e4075e8bdffd93a9b6d6e1d52fabedceeca5a91b ]

    if seq_file .next fuction does not change position index,
    read after some lseek can generate unexpected output.

    Without patch:
    # dd bs=4 skip=1 if=/sys/kernel/tracing/set_ftrace_pid
    dd: /sys/kernel/tracing/set_ftrace_pid: cannot skip to specified offset
    id
    no pid
    2+1 records in
    2+1 records out
    10 bytes copied, 0.000213285 s, 46.9 kB/s

    Notice the "id" followed by "no pid".

    With the patch:
    # dd bs=4 skip=1 if=/sys/kernel/tracing/set_ftrace_pid
    dd: /sys/kernel/tracing/set_ftrace_pid: cannot skip to specified offset
    id
    0+1 records in
    0+1 records out
    3 bytes copied, 0.000202112 s, 14.8 kB/s

    Notice that it only prints "id" and not the "no pid" afterward.

    Link: http://lkml.kernel.org/r/4f87c6ad-f114-30bb-8506-c32274ce2992@virtuozzo.com

    https://bugzilla.kernel.org/show_bug.cgi?id=206283
    Signed-off-by: Vasily Averin
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Sasha Levin

    Vasily Averin
     
  • [ Upstream commit 98c49f1746ac44ccc164e914b9a44183fad09f51 ]

    Currently, there is an out-of-bounds read on array hpetp->hp_dev
    in the following for loop:

    870 for (i = 0; i < hdp->hd_nirqs; i++)
    871 hpetp->hp_dev[i].hd_hdwirq = hdp->hd_irq[i];

    This is due to the recent change from one-element array to
    flexible-array member in struct hpets:

    104 struct hpets {
    ...
    113 struct hpet_dev hp_dev[];
    114 };

    This change affected the total size of the dynamic memory
    allocation, decreasing it by one time the size of struct hpet_dev.

    Fix this by adjusting the allocation size when calling
    struct_size().

    Fixes: 987f028b8637c ("char: hpet: Use flexible-array member")
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Tetsuo Handa
    Acked-by: Eric Biggers
    Link: https://lore.kernel.org/r/20200129022613.GA24281@embeddedor.com
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Gustavo A. R. Silva
     
  • [ Upstream commit 0e6176c6d286316e9431b4f695940cfac4ffe6c2 ]

    The implementations for most channel types contains a map of methods to
    priv registers in order to provide debugging info when a disp exception
    has been raised.

    This info is missing from the implementation of PIO channels as they're
    rather simplistic already, however, if an exception is raised by one of
    them, we'd end up triggering a NULL-pointer deref. Not ideal...

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=206299
    Signed-off-by: Ben Skeggs
    Signed-off-by: Sasha Levin

    Ben Skeggs
     
  • [ Upstream commit 926b5dfa6b8dc666ff398044af6906b156e1d949 ]

    We currently allocate redistributor region structures for
    individual redistributors when ACPI doesn't present us with
    compact MMIO regions covering multiple redistributors.

    It turns out that we allocate these structures even when
    the redistributor is flagged as disabled by ACPI. It works
    fine until someone actually tries to tarse one of these
    structures, and access the corresponding MMIO region.

    Instead, track the number of enabled redistributors, and
    only allocate what is required. This makes sure that there
    is no invalid data to misuse.

    Signed-off-by: Marc Zyngier
    Reported-by: Heyi Guo
    Tested-by: Heyi Guo
    Link: https://lore.kernel.org/r/20191216062745.63397-1-guoheyi@huawei.com
    Signed-off-by: Sasha Levin

    Marc Zyngier
     
  • [ Upstream commit bb67bfd2e7101bf2ac5327b0b7a847cd9fb9723f ]

    This allocation isn't required and can fail when resuming from suspend.

    Bug: https://gitlab.freedesktop.org/drm/amd/issues/1009
    Signed-off-by: Dor Askayo
    Reviewed-by: Leo Li
    Signed-off-by: Alex Deucher
    Signed-off-by: Sasha Levin

    Dor Askayo
     
  • [ Upstream commit a55e601b2f02df5db7070e9a37bd655c9c576a52 ]

    gcc -O3 warns about a dummy variable that is passed
    down into rbd_img_fill_nodata without being initialized:

    drivers/block/rbd.c: In function 'rbd_img_fill_nodata':
    drivers/block/rbd.c:2573:13: error: 'dummy' is used uninitialized in this function [-Werror=uninitialized]
    fctx->iter = *fctx->pos;

    Since this is a dummy, I assume the warning is harmless, but
    it's better to initialize it anyway and avoid the warning.

    Fixes: mmtom ("init/Kconfig: enable -O3 for all arches")
    Signed-off-by: Arnd Bergmann
    Reviewed-by: Ilya Dryomov
    Signed-off-by: Ilya Dryomov
    Signed-off-by: Sasha Levin

    Arnd Bergmann
     
  • [ Upstream commit 97820058fb2831a4b203981fa2566ceaaa396103 ]

    If all the MDS daemons are down for some reason, then the first mount
    attempt will fail with EIO after the mount request times out. A mount
    attempt will also fail with EIO if all of the MDS's are laggy.

    This patch changes the code to return -EHOSTUNREACH in these situations
    and adds a pr_info error message to help the admin determine the cause.

    URL: https://tracker.ceph.com/issues/4386
    Signed-off-by: Xiubo Li
    Reviewed-by: Jeff Layton
    Signed-off-by: Ilya Dryomov
    Signed-off-by: Sasha Levin

    Xiubo Li
     
  • [ Upstream commit 0f9aee0cb9da7db7d96f63cfa2dc5e4f1bffeb87 ]

    Running vdsotest leaves many times the following log:

    [ 79.629901] vdsotest[396]: User access of kernel address (ffffffff) - exploit attempt? (uid: 0)

    A pointer set to (-1) is likely a programming error similar to
    a NULL pointer and is not worth logging as an exploit attempt.

    Don't log user accesses to 0xffffffff.

    Signed-off-by: Christophe Leroy
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/0728849e826ba16f1fbd6fa7f5c6cc87bd64e097.1577087627.git.christophe.leroy@c-s.fr
    Signed-off-by: Sasha Levin

    Christophe Leroy
     
  • [ Upstream commit 90435a7891a2259b0f74c5a1bc5600d0d64cba8f ]

    If seq_file .next fuction does not change position index,
    read after some lseek can generate an unexpected output.

    See also: https://bugzilla.kernel.org/show_bug.cgi?id=206283

    v1 -> v2: removed missed increment in end of function

    Signed-off-by: Vasily Averin
    Signed-off-by: Daniel Borkmann
    Link: https://lore.kernel.org/bpf/eca84fdd-c374-a154-d874-6c7b55fc3bc4@virtuozzo.com
    Signed-off-by: Sasha Levin

    Vasily Averin
     
  • [ Upstream commit fe1292686333d1dadaf84091f585ee903b9ddb84 ]

    RHBZ: 1760879

    Fix an oops in match_prepath() by making sure that the prepath string is not
    NULL before we pass it into strcmp().

    This is similar to other checks we make for example in cifs_root_iget()

    Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French
    Signed-off-by: Sasha Levin

    Ronnie Sahlberg
     
  • [ Upstream commit 5739375ee4230980166807d347cc21c305532bbc ]

    Starting from 4a367dc04435, we must set the mount options based on the
    DFS full path rather than the resolved target, that is, cifs_mount()
    will be responsible for resolving the DFS link (cached) as well as
    performing failover to any other targets in the referral.

    Signed-off-by: Paulo Alcantara (SUSE)
    Reported-by: Martijn de Gouw
    Fixes: 4a367dc04435 ("cifs: Add support for failover in cifs_mount()")
    Link: https://lore.kernel.org/linux-cifs/39643d7d-2abb-14d3-ced6-c394fab9a777@prodrive-technologies.com
    Tested-by: Martijn de Gouw
    Signed-off-by: Steve French
    Signed-off-by: Sasha Levin

    Paulo Alcantara (SUSE)
     
  • [ Upstream commit 463a7b457c02250a84faa1d23c52da9e3364aed2 ]

    static analysis with Coverity detected an issue with the following
    commit:

    Author: Paulo Alcantara (SUSE)
    Date: Wed Dec 4 17:38:03 2019 -0300

    cifs: Avoid doing network I/O while holding cache lock

    Addresses-Coverity: ("Uninitialized pointer read")
    Reported-by: Colin Ian King
    Signed-off-by: Paulo Alcantara (SUSE)
    Signed-off-by: Steve French
    Signed-off-by: Sasha Levin

    Steve French
     
  • [ Upstream commit c2f9a4e4a5abfc84c01b738496b3fd2d471e0b18 ]

    The loop counter addr is a u16 where as the upper limit of the loop
    is an int. In the unlikely event that the il->cfg->eeprom_size is
    greater than 64K then we end up with an infinite loop since addr will
    wrap around an never reach upper loop limit. Fix this by making addr
    an int.

    Addresses-Coverity: ("Infinite loop")
    Fixes: be663ab67077 ("iwlwifi: split the drivers for agn and legacy devices 3945/4965")
    Signed-off-by: Colin Ian King
    Acked-by: Stanislaw Gruszka
    Signed-off-by: Kalle Valo
    Signed-off-by: Sasha Levin

    Colin Ian King
     
  • [ Upstream commit f4f84ff8377d4cedf18317747bc407b2cf657d0f ]

    Sometimes the TX queue may be empty and we could possible
    dequeue a NULL pointer, crash the kernel. If the skb is NULL
    then there is nothing to do, just leave the ISR.

    And the TX queue should not be empty here, so print an error
    to see if there is anything wrong for DMA ring.

    Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
    Signed-off-by: Yan-Hsuan Chuang
    Signed-off-by: Kalle Valo
    Signed-off-by: Sasha Levin

    Yan-Hsuan Chuang
     
  • [ Upstream commit b61156fba74f659d0bc2de8f2dbf5bad9f4b8faf ]

    Clang warns:

    ../drivers/net/wireless/intersil/hostap/hostap_ap.c:2511:3: warning:
    misleading indentation; statement is not part of the previous 'if'
    [-Wmisleading-indentation]
    if (sta->tx_supp_rates & WLAN_RATE_5M5)
    ^
    ../drivers/net/wireless/intersil/hostap/hostap_ap.c:2509:2: note:
    previous statement is here
    if (sta->tx_supp_rates & WLAN_RATE_2M)
    ^
    1 warning generated.

    This warning occurs because there is a space before the tab on this
    line. Remove it so that the indentation is consistent with the Linux
    kernel coding style and clang no longer warns.

    Fixes: ff1d2767d5a4 ("Add HostAP wireless driver.")
    Link: https://github.com/ClangBuiltLinux/linux/issues/813
    Signed-off-by: Nathan Chancellor
    Reviewed-by: Nick Desaulniers
    Signed-off-by: Kalle Valo
    Signed-off-by: Sasha Levin

    Nathan Chancellor
     
  • [ Upstream commit b81cbf7abfc94878a3c6f0789f2185ee55b1cc21 ]

    With firmware 2.82 Line6 changed the usb id of some of the Helix
    devices but the quirks is still needed.

    Add it to the quirk list for line6 helix family of devices.

    Thanks to Jens for pointing out the missing ids.

    Signed-off-by: Nicola Lunghi
    Link: https://lore.kernel.org/r/20200125150917.5040-1-nick83ola@gmail.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Nicola Lunghi
     
  • [ Upstream commit 76950f7162cad51d2200ebd22c620c14af38f718 ]

    To perform the reserve_crashkernel() operation kexec uses SECTION_SIZE to
    find a memblock in a range.
    SECTION_SIZE is not defined for nommu systems. Trying to compile kexec in
    these conditions results in a build error:

    linux/arch/arm/kernel/setup.c: In function ‘reserve_crashkernel’:
    linux/arch/arm/kernel/setup.c:1016:25: error: ‘SECTION_SIZE’ undeclared
    (first use in this function); did you mean ‘SECTIONS_WIDTH’?
    crash_size, SECTION_SIZE);
    ^~~~~~~~~~~~
    SECTIONS_WIDTH
    linux/arch/arm/kernel/setup.c:1016:25: note: each undeclared identifier
    is reported only once for each function it appears in
    linux/scripts/Makefile.build:265: recipe for target 'arch/arm/kernel/setup.o'
    failed

    Make KEXEC depend on MMU to fix the compilation issue.

    Signed-off-by: Vincenzo Frascino
    Signed-off-by: Russell King
    Signed-off-by: Sasha Levin

    Vincenzo Frascino
     
  • [ Upstream commit 414f50434aa2463202a5b35e844f4125dd1a7101 ]

    Some newer cards supported by aacraid can take up to 40s to recover
    after an EEH event. This causes spurious failures in the basic EEH
    self-test since the current maximim timeout is only 30s.

    Fix the immediate issue by bumping the timeout to a default of 60s,
    and allow the wait time to be specified via an environmental variable
    (EEH_MAX_WAIT).

    Reported-by: Steve Best
    Suggested-by: Douglas Miller
    Signed-off-by: Oliver O'Halloran
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200122031125.25991-1-oohall@gmail.com
    Signed-off-by: Sasha Levin

    Oliver O'Halloran
     
  • [ Upstream commit f1dbc1c5c70d0d4c60b5d467ba941fba167c12f6 ]

    Correct overflow problem in calculation and display of Maximum Memory
    value to syscfg.

    Signed-off-by: Michael Bringmann
    [mpe: Only n_lmbs needs casting to unsigned long]
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/5577aef8-1d5a-ca95-ff0a-9c7b5977e5bf@linux.ibm.com
    Signed-off-by: Sasha Levin

    Michael Bringmann
     
  • [ Upstream commit 0e98c084a21177ef136149c6a293b3d1eb33ff92 ]

    Commit fb7c02445c49 ("ext4: pass -ESHUTDOWN code to jbd2 layer") want
    to allow jbd2 layer to distinguish shutdown journal abort from other
    error cases. So the ESHUTDOWN should be taken precedence over any other
    errno which has already been recoded after EXT4_FLAGS_SHUTDOWN is set,
    but it only update errno in the journal suoerblock now if the old errno
    is 0.

    Fixes: fb7c02445c49 ("ext4: pass -ESHUTDOWN code to jbd2 layer")
    Signed-off-by: zhangyi (F)
    Reviewed-by: Jan Kara
    Link: https://lore.kernel.org/r/20191204124614.45424-4-yi.zhang@huawei.com
    Signed-off-by: Theodore Ts'o
    Signed-off-by: Sasha Levin

    zhangyi (F)
     
  • [ Upstream commit d0a186e0d3e7ac05cc77da7c157dae5aa59f95d9 ]

    We invoke jbd2_journal_abort() to abort the journal and record errno
    in the jbd2 superblock when committing journal transaction besides the
    failure on submitting the commit record. But there is no need for the
    case and we can also invoke jbd2_journal_abort() instead of
    __jbd2_journal_abort_hard().

    Fixes: 818d276ceb83a ("ext4: Add the journal checksum feature")
    Signed-off-by: zhangyi (F)
    Reviewed-by: Jan Kara
    Link: https://lore.kernel.org/r/20191204124614.45424-2-yi.zhang@huawei.com
    Signed-off-by: Theodore Ts'o
    Signed-off-by: Sasha Levin

    zhangyi (F)
     
  • [ Upstream commit 51bad0f05616c43d6d34b0a19bcc9bdab8e8fb39 ]

    Currently, there is a lot of false positives if a single reuseport test
    fails. This is because expected_results and the result map are not cleared.

    Zero both after individual test runs, which fixes the mentioned false
    positives.

    Fixes: 91134d849a0e ("bpf: Test BPF_PROG_TYPE_SK_REUSEPORT")
    Signed-off-by: Lorenz Bauer
    Signed-off-by: Daniel Borkmann
    Reviewed-by: Jakub Sitnicki
    Acked-by: Martin KaFai Lau
    Acked-by: John Fastabend
    Link: https://lore.kernel.org/bpf/20200124112754.19664-5-lmb@cloudflare.com
    Signed-off-by: Sasha Levin

    Lorenz Bauer
     
  • [ Upstream commit c79108bd19a8490315847e0c95ac6526fcd8e770 ]

    The alarmtimer_suspend() function will fail if an RTC device is on a bus
    such as SPI or i2c and that RTC device registers and probes after
    alarmtimer_init() registers and probes the 'alarmtimer' platform device.

    This is because system wide suspend suspends devices in the reverse order
    of their probe. When alarmtimer_suspend() attempts to program the RTC for a
    wakeup it will try to program an RTC device on a bus that has already been
    suspended.

    Move the alarmtimer device registration to happen when the RTC which is
    used for wakeup is registered. Register the 'alarmtimer' platform device as
    a child of the RTC device too, so that it can be guaranteed that the RTC
    device won't be suspended when alarmtimer_suspend() is called.

    Reported-by: Douglas Anderson
    Signed-off-by: Stephen Boyd
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Douglas Anderson
    Link: https://lore.kernel.org/r/20200124055849.154411-2-swboyd@chromium.org
    Signed-off-by: Sasha Levin

    Stephen Boyd
     
  • [ Upstream commit 857f081426e5aa38313426c13373730f1345fe95 ]

    Address field in device TLB invalidation descriptor is qualified
    by the S field. If S field is zero, a single page at page address
    specified by address [63:12] is requested to be invalidated. If S
    field is set, the least significant bit in the address field with
    value 0b (say bit N) indicates the invalidation address range. The
    spec doesn't require the address [N - 1, 0] to be cleared, hence
    remove the unnecessary WARN_ON_ONCE().

    Otherwise, the caller might set "mask = MAX_AGAW_PFN_WIDTH" in order
    to invalidating all the cached mappings on an endpoint, and below
    overflow error will be triggered.

    [...]
    UBSAN: Undefined behaviour in drivers/iommu/dmar.c:1354:3
    shift exponent 64 is too large for 64-bit type 'long long unsigned int'
    [...]

    Reported-and-tested-by: Frank
    Signed-off-by: Lu Baolu
    Signed-off-by: Joerg Roedel
    Signed-off-by: Sasha Levin

    Lu Baolu
     
  • [ Upstream commit ae3cd299919af6eb670d5af0bc9d7ba14086bd8e ]

    The patch "bcache: rework error unwinding in register_bcache" introduces
    a use-after-free regression in register_bcache(). Here are current code,
    2510 out_free_path:
    2511 kfree(path);
    2512 out_module_put:
    2513 module_put(THIS_MODULE);
    2514 out:
    2515 pr_info("error %s: %s", path, err);
    2516 return ret;
    If some error happens and the above code path is executed, at line 2511
    path is released, but referenced at line 2515. Then KASAN reports a use-
    after-free error message.

    This patch changes line 2515 in the following way to fix the problem,
    2515 pr_info("error %s: %s", path?path:"", err);

    Signed-off-by: Coly Li
    Cc: Christoph Hellwig
    Signed-off-by: Jens Axboe
    Signed-off-by: Sasha Levin

    Coly Li
     
  • [ Upstream commit 50246693f81fe887f4db78bf7089051d7f1894cc ]

    Split the successful and error return path, and use one goto label for each
    resource to unwind. This also fixes some small errors like leaking the
    module reference count in the reboot case (which seems entirely harmless)
    or printing the wrong warning messages for early failures.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Coly Li
    Signed-off-by: Jens Axboe
    Signed-off-by: Sasha Levin

    Christoph Hellwig
     
  • [ Upstream commit e8547d42095e58bee658f00fef8e33d2a185c927 ]

    Same as cache device, the buffer page needs to be put while
    freeing cached_dev. Otherwise a page would be leaked every
    time a cached_dev is stopped.

    Signed-off-by: Liang Chen
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Coly Li
    Signed-off-by: Jens Axboe
    Signed-off-by: Sasha Levin

    Liang Chen
     
  • [ Upstream commit 1362089d2ad7e20d16371b39d3c11990d4ec23e4 ]

    Current code doesn't correctly handle the situation which arises when
    a file system that has METADATA_UUID_INCOMPAT flag set and has its FSID
    changed to the one in metadata uuid. This causes the incompat flag to
    disappear.

    In case of a power failure we could end up in a situation where part of
    the disks in a multi-disk filesystem are correctly reverted to
    METADATA_UUID_INCOMPAT flag unset state, while others have
    METADATA_UUID_INCOMPAT set and CHANGING_FSID_V2_IN_PROGRESS.

    This patch corrects the behavior required to handle the case where a
    disk of the second type is scanned first, creating the necessary
    btrfs_fs_devices. Subsequently, when a disk which has already completed
    the transition is scanned it should overwrite the data in
    btrfs_fs_devices.

    Reported-by: Su Yue
    Reviewed-by: Josef Bacik
    Signed-off-by: Nikolay Borisov
    Reviewed-by: David Sterba
    Signed-off-by: David Sterba
    Signed-off-by: Sasha Levin

    Nikolay Borisov
     
  • [ Upstream commit 68c467cbb2f389b6c933e235bce0d1756fc8cc34 ]

    There's a report where objtool detects unreachable instructions, eg.:

    fs/btrfs/ctree.o: warning: objtool: btrfs_search_slot()+0x2d4: unreachable instruction

    This seems to be a false positive due to compiler version. The cause is
    in the ASSERT macro implementation that does the conditional check as
    IS_DEFINED(CONFIG_BTRFS_ASSERT) and not an #ifdef.

    To avoid that, use the ifdefs directly.

    There are still 2 reports that aren't fixed:

    fs/btrfs/extent_io.o: warning: objtool: __set_extent_bit()+0x71f: unreachable instruction
    fs/btrfs/relocation.o: warning: objtool: find_data_references()+0x4e0: unreachable instruction

    Co-developed-by: Josh Poimboeuf
    Signed-off-by: Josh Poimboeuf
    Reported-by: Randy Dunlap
    Signed-off-by: David Sterba
    Signed-off-by: Sasha Levin

    David Sterba
     
  • [ Upstream commit 1dd2e8f942574e2be18374ebb81751082d8d467c ]

    This device does not function correctly in raw mode in kernel
    versions validating buffer sizes in bulk mode. It erroneously
    announces 16 bits per pixel instead of 12 for NV12 format, so it
    needs this quirk to fix computed frame size and avoid legitimate
    frames getting discarded.

    [Move info and div variables to local scope]

    Signed-off-by: Sergey Zakharchenko
    Signed-off-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Sasha Levin

    Sergey Zakharchenko
     
  • [ Upstream commit 1fb4124ca9d456656a324f1ee29b7bf942f59ac8 ]

    When disabling virtual functions on an SR-IOV adapter we currently do not
    correctly remove the EEH state for the now-dead virtual functions. When
    removing the pci_dn that was created for the VF when SR-IOV was enabled
    we free the corresponding eeh_dev without removing it from the child device
    list of the eeh_pe that contained it. This can result in crashes due to the
    use-after-free.

    Signed-off-by: Oliver O'Halloran
    Reviewed-by: Sam Bobroff
    Tested-by: Sam Bobroff
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20190821062655.19735-1-oohall@gmail.com
    Signed-off-by: Sasha Levin

    Oliver O'Halloran
     
  • [ Upstream commit 35e4909b6a2b4005ced3c4238da60d926b78fdea ]

    Signed-off-by: Ben Skeggs
    Signed-off-by: Sasha Levin

    Ben Skeggs
     
  • [ Upstream commit 1d82163714c16ebe09c7a8c9cd3cef7abcc16208 ]

    When we unhash the cache entry, we need to handle any pending upcalls
    by calling cache_fresh_unlocked().

    Signed-off-by: Trond Myklebust
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Sasha Levin

    Trond Myklebust
     
  • [ Upstream commit ef7d84caa5928b40b1c93a26dbe5a3f12737c6ab ]

    Lenovo Thinkpad T420s uses the same codec as T420, so apply the
    same quirk to enable audio output on a docking station.

    Signed-off-by: Peter Große
    Link: https://lore.kernel.org/r/20200122180106.9351-1-pegro@friiks.de
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Peter Große