Skip to content
  1. May 02, 2020
    • Greg Kroah-Hartman's avatar
      Linux 4.9.221 · 775dfa8c
      Greg Kroah-Hartman authored
      v4.9.221
      775dfa8c
    • Al Viro's avatar
      propagate_one(): mnt_set_mountpoint() needs mount_lock · fcd41818
      Al Viro authored
      commit b0d3869c
      
       upstream.
      
      ... to protect the modification of mp->m_count done by it.  Most of
      the places that modify that thing also have namespace_lock held,
      but not all of them can do so, so we really need mount_lock here.
      Kudos to Piotr Krysiuk <piotras@gmail.com>, who'd spotted a related
      bug in pivot_root(2) (fixed unnoticed in 5.3); search for other
      similar turds has caught out this one.
      
      Cc: stable@kernel.org
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarPiotr Krysiuk <piotras@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fcd41818
    • Ritesh Harjani's avatar
      ext4: check for non-zero journal inum in ext4_calculate_overhead · b1880905
      Ritesh Harjani authored
      commit f1eec3b0 upstream.
      
      While calculating overhead for internal journal, also check
      that j_inum shouldn't be 0. Otherwise we get below error with
      xfstests generic/050 with external journal (XXX_LOGDEV config) enabled.
      
      It could be simply reproduced with loop device with an external journal
      and marking blockdev as RO before mounting.
      
      [ 3337.146838] EXT4-fs error (device pmem1p2): ext4_get_journal_inode:4634: comm mount: inode #0: comm mount: iget: illegal inode #
      ------------[ cut here ]------------
      generic_make_request: Trying to write to read-only block-device pmem1p2 (partno 2)
      WARNING: CPU: 107 PID: 115347 at block/blk-core.c:788 generic_make_request_checks+0x6b4/0x7d0
      CPU: 107 PID: 115347 Comm: mount Tainted: G             L   --------- -t - 4.18.0-167.el8.ppc64le #1
      NIP:  c0000000006f6d44 LR: c0000000006f6d40 CTR: 0000000030041dd4
      <...>
      NIP [c0000000006f6d44] generic_make_request_checks+0x6b4/0x7d0
      LR [c0000000006f6d40] generic_make_request_checks+0x6b0/0x7d0
      <...>
      Call Trace:
      generic_make_request_checks+0x6b0/0x7d0 (unreliable)
      generic_make_request+0x3c/0x420
      submit_bio+0xd8/0x200
      submit_bh_wbc+0x1e8/0x250
      __sync_dirty_buffer+0xd0/0x210
      ext4_commit_super+0x310/0x420 [ext4]
      __ext4_error+0xa4/0x1e0 [ext4]
      __ext4_iget+0x388/0xe10 [ext4]
      ext4_get_journal_inode+0x40/0x150 [ext4]
      ext4_calculate_overhead+0x5a8/0x610 [ext4]
      ext4_fill_super+0x3188/0x3260 [ext4]
      mount_bdev+0x778/0x8f0
      ext4_mount+0x28/0x50 [ext4]
      mount_fs+0x74/0x230
      vfs_kern_mount.part.6+0x6c/0x250
      do_mount+0x2fc/0x1280
      sys_mount+0x158/0x180
      system_call+0x5c/0x70
      EXT4-fs (pmem1p2): no journal found
      EXT4-fs (pmem1p2): can't get journal size
      EXT4-fs (pmem1p2): mounted filesystem without journal. Opts: dax,norecovery
      
      Fixes: 3c816ded
      
       ("ext4: use journal inode to determine journal overhead")
      Reported-by: default avatarHarish Sriram <harish@linux.ibm.com>
      Signed-off-by: default avatarRitesh Harjani <riteshh@linux.ibm.com>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20200316093038.25485-1-riteshh@linux.ibm.com
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b1880905
    • Colin Ian King's avatar
      ext4: unsigned int compared against zero · 5a905c2d
      Colin Ian King authored
      commit fbbbbd2f upstream.
      
      There are two cases where u32 variables n and err are being checked
      for less than zero error values, the checks is always false because
      the variables are not signed. Fix this by making the variables ints.
      
      Addresses-Coverity: ("Unsigned compared against 0")
      Fixes: 345c0dbf
      
       ("ext4: protect journal inode's blocks using block_validity")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarAshwin H <ashwinh@vmware.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5a905c2d
    • Theodore Ts'o's avatar
      ext4: fix block validity checks for journal inodes using indirect blocks · 12140f9b
      Theodore Ts'o authored
      commit 170417c8 upstream.
      
      Commit 345c0dbf ("ext4: protect journal inode's blocks using
      block_validity") failed to add an exception for the journal inode in
      ext4_check_blockref(), which is the function used by ext4_get_branch()
      for indirect blocks.  This caused attempts to read from the ext3-style
      journals to fail with:
      
      [  848.968550] EXT4-fs error (device sdb7): ext4_get_branch:171: inode #8: block 30343695: comm jbd2/sdb7-8: invalid block
      
      Fix this by adding the missing exception check.
      
      Fixes: 345c0dbf
      
       ("ext4: protect journal inode's blocks using block_validity")
      Reported-by: default avatarArthur Marsh <arthur.marsh@internode.on.net>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarAshwin H <ashwinh@vmware.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      12140f9b
    • Theodore Ts'o's avatar
      ext4: don't perform block validity checks on the journal inode · 2130aae8
      Theodore Ts'o authored
      commit 0a944e8a upstream.
      
      Since the journal inode is already checked when we added it to the
      block validity's system zone, if we check it again, we'll just trigger
      a failure.
      
      This was causing failures like this:
      
      [   53.897001] EXT4-fs error (device sda): ext4_find_extent:909: inode
      #8: comm jbd2/sda-8: pblk 121667583 bad header/extent: invalid extent entries - magic f30a, entries 8, max 340(340), depth 0(0)
      [   53.931430] jbd2_journal_bmap: journal block not found at offset 49 on sda-8
      [   53.938480] Aborting journal on device sda-8.
      
      ... but only if the system was under enough memory pressure that
      logical->physical mapping for the journal inode gets pushed out of the
      extent cache.  (This is why it wasn't noticed earlier.)
      
      Fixes: 345c0dbf
      
       ("ext4: protect journal inode's blocks using block_validity")
      Reported-by: default avatarDan Rue <dan.rue@linaro.org>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Tested-by: default avatarNaresh Kamboju <naresh.kamboju@linaro.org>
      Signed-off-by: default avatarAshwin H <ashwinh@vmware.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2130aae8
    • Theodore Ts'o's avatar
      ext4: protect journal inode's blocks using block_validity · a9855260
      Theodore Ts'o authored
      commit 345c0dbf
      
       upstream.
      
      Add the blocks which belong to the journal inode to block_validity's
      system zone so attempts to deallocate or overwrite the journal due a
      corrupted file system where the journal blocks are also claimed by
      another inode.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202879
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      Signed-off-by: default avatarAshwin H <ashwinh@vmware.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a9855260
    • Theodore Ts'o's avatar
      ext4: avoid declaring fs inconsistent due to invalid file handles · 553f7c0b
      Theodore Ts'o authored
      commit 8a363970
      
       upstream.
      
      If we receive a file handle, either from NFS or open_by_handle_at(2),
      and it points at an inode which has not been initialized, and the file
      system has metadata checksums enabled, we shouldn't try to get the
      inode, discover the checksum is invalid, and then declare the file
      system as being inconsistent.
      
      This can be reproduced by creating a test file system via "mke2fs -t
      ext4 -O metadata_csum /tmp/foo.img 8M", mounting it, cd'ing into that
      directory, and then running the following program.
      
      #define _GNU_SOURCE
      #include <fcntl.h>
      
      struct handle {
      	struct file_handle fh;
      	unsigned char fid[MAX_HANDLE_SZ];
      };
      
      int main(int argc, char **argv)
      {
      	struct handle h = {{8, 1 }, { 12, }};
      
      	open_by_handle_at(AT_FDCWD, &h.fh, O_RDONLY);
      	return 0;
      }
      
      Google-Bug-Id: 120690101
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      Signed-off-by: default avatarAshwin H <ashwinh@vmware.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      553f7c0b
    • Sascha Hauer's avatar
      hwmon: (jc42) Fix name to have no illegal characters · 9368835d
      Sascha Hauer authored
      [ Upstream commit c843b382
      
       ]
      
      The jc42 driver passes I2C client's name as hwmon device name. In case
      of device tree probed devices this ends up being part of the compatible
      string, "jc-42.4-temp". This name contains hyphens and the hwmon core
      doesn't like this:
      
      jc42 2-0018: hwmon: 'jc-42.4-temp' is not a valid name attribute, please fix
      
      This changes the name to "jc42" which doesn't have any illegal
      characters.
      
      Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
      Link: https://lore.kernel.org/r/20200417092853.31206-1-s.hauer@pengutronix.de
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9368835d
    • Theodore Ts'o's avatar
      ext4: convert BUG_ON's to WARN_ON's in mballoc.c · ae8bbfeb
      Theodore Ts'o authored
      [ Upstream commit 907ea529
      
       ]
      
      If the in-core buddy bitmap gets corrupted (or out of sync with the
      block bitmap), issue a WARN_ON and try to recover.  In most cases this
      involves skipping trying to allocate out of a particular block group.
      We can end up declaring the file system corrupted, which is fair,
      since the file system probably should be checked before we proceed any
      further.
      
      Link: https://lore.kernel.org/r/20200414035649.293164-1-tytso@mit.edu
      Google-Bug-Id: 34811296
      Google-Bug-Id: 34639169
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ae8bbfeb
    • Juergen Gross's avatar
      xen/xenbus: ensure xenbus_map_ring_valloc() returns proper grant status · ae52960b
      Juergen Gross authored
      [ Upstream commit 6b51fd3f
      
       ]
      
      xenbus_map_ring_valloc() maps a ring page and returns the status of the
      used grant (0 meaning success).
      
      There are Xen hypervisors which might return the value 1 for the status
      of a failed grant mapping due to a bug. Some callers of
      xenbus_map_ring_valloc() test for errors by testing the returned status
      to be less than zero, resulting in no error detected and crashing later
      due to a not available ring page.
      
      Set the return value of xenbus_map_ring_valloc() to GNTST_general_error
      in case the grant status reported by Xen is greater than zero.
      
      This is part of XSA-316.
      
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarWei Liu <wl@xen.org>
      Link: https://lore.kernel.org/r/20200326080358.1018-1-jgross@suse.com
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ae52960b
    • Josh Poimboeuf's avatar
      objtool: Support Clang non-section symbols in ORC dump · 1d97e72f
      Josh Poimboeuf authored
      [ Upstream commit 8782e7ca
      
       ]
      
      Historically, the relocation symbols for ORC entries have only been
      section symbols:
      
        .text+0: sp:sp+8 bp:(und) type:call end:0
      
      However, the Clang assembler is aggressive about stripping section
      symbols.  In that case we will need to use function symbols:
      
        freezing_slow_path+0: sp:sp+8 bp:(und) type:call end:0
      
      In preparation for the generation of such entries in "objtool orc
      generate", add support for reading them in "objtool orc dump".
      
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Reviewed-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/b811b5eb1a42602c3b523576dc5efab9ad1c174d.1585761021.git.jpoimboe@redhat.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1d97e72f
    • Josh Poimboeuf's avatar
      objtool: Fix CONFIG_UBSAN_TRAP unreachable warnings · e1f81c94
      Josh Poimboeuf authored
      [ Upstream commit bd841d61
      
       ]
      
      CONFIG_UBSAN_TRAP causes GCC to emit a UD2 whenever it encounters an
      unreachable code path.  This includes __builtin_unreachable().  Because
      the BUG() macro uses __builtin_unreachable() after it emits its own UD2,
      this results in a double UD2.  In this case objtool rightfully detects
      that the second UD2 is unreachable:
      
        init/main.o: warning: objtool: repair_env_string()+0x1c8: unreachable instruction
      
      We weren't able to figure out a way to get rid of the double UD2s, so
      just silence the warning.
      
      Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/6653ad73c6b59c049211bd7c11ed3809c20ee9f5.1585761021.git.jpoimboe@redhat.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e1f81c94
    • Bodo Stroesser's avatar
      scsi: target: fix PR IN / READ FULL STATUS for FC · a474af11
      Bodo Stroesser authored
      [ Upstream commit 8fed04eb
      
       ]
      
      Creation of the response to READ FULL STATUS fails for FC based
      reservations. Reason is the too high loop limit (< 24) in
      fc_get_pr_transport_id(). The string representation of FC WWPN is 23 chars
      long only ("11:22:33:44:55:66:77:88"). So when i is 23, the loop body is
      executed a last time for the ending '\0' of the string and thus hex2bin()
      reports an error.
      
      Link: https://lore.kernel.org/r/20200408132610.14623-3-bstroesser@ts.fujitsu.com
      Signed-off-by: default avatarBodo Stroesser <bstroesser@ts.fujitsu.com>
      Reviewed-by: default avatarMike Christie <mchristi@redhat.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a474af11
    • Darrick J. Wong's avatar
      xfs: fix partially uninitialized structure in xfs_reflink_remap_extent · 83693a55
      Darrick J. Wong authored
      [ Upstream commit c142932c
      
       ]
      
      In the reflink extent remap function, it turns out that uirec (the block
      mapping corresponding only to the part of the passed-in mapping that got
      unmapped) was not fully initialized.  Specifically, br_state was not
      being copied from the passed-in struct to the uirec.  This could lead to
      unpredictable results such as the reflinked mapping being marked
      unwritten in the destination file.
      
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      83693a55
    • Luke Nelson's avatar
      bpf, x86: Fix encoding for lower 8-bit registers in BPF_STX BPF_B · 2cb2bcf8
      Luke Nelson authored
      [ Upstream commit aee194b1 ]
      
      This patch fixes an encoding bug in emit_stx for BPF_B when the source
      register is BPF_REG_FP.
      
      The current implementation for BPF_STX BPF_B in emit_stx saves one REX
      byte when the operands can be encoded using Mod-R/M alone. The lower 8
      bits of registers %rax, %rbx, %rcx, and %rdx can be accessed without using
      a REX prefix via %al, %bl, %cl, and %dl, respectively. Other registers,
      (e.g., %rsi, %rdi, %rbp, %rsp) require a REX prefix to use their 8-bit
      equivalents (%sil, %dil, %bpl, %spl).
      
      The current code checks if the source for BPF_STX BPF_B is BPF_REG_1
      or BPF_REG_2 (which map to %rdi and %rsi), in which case it emits the
      required REX prefix. However, it misses the case when the source is
      BPF_REG_FP (mapped to %rbp).
      
      The result is that BPF_STX BPF_B with BPF_REG_FP as the source operand
      will read from register %ch instead of the correct %bpl. This patch fixes
      the problem by fixing and refactoring the check on which registers need
      the extra REX byte. Since no BPF registers map to %rsp, there is no need
      to handle %spl.
      
      Fixes: 62258278
      
       ("net: filter: x86: internal BPF JIT")
      Signed-off-by: default avatarXi Wang <xi.wang@gmail.com>
      Signed-off-by: default avatarLuke Nelson <luke.r.nels@gmail.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20200418232655.23870-1-luke.r.nels@gmail.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2cb2bcf8
    • Ian Rogers's avatar
      perf/core: fix parent pid/tid in task exit events · ed0e49c6
      Ian Rogers authored
      commit f3bed55e upstream.
      
      Current logic yields the child task as the parent.
      
      Before:
      $ perf record bash -c "perf list > /dev/null"
      $ perf script -D |grep 'FORK\|EXIT'
      4387036190981094 0x5a70 [0x30]: PERF_RECORD_FORK(10472:10472):(10470:10470)
      4387036606207580 0xf050 [0x30]: PERF_RECORD_EXIT(10472:10472):(10472:10472)
      4387036607103839 0x17150 [0x30]: PERF_RECORD_EXIT(10470:10470):(10470:10470)
                                                         ^
        Note the repeated values here -------------------/
      
      After:
      383281514043 0x9d8 [0x30]: PERF_RECORD_FORK(2268:2268):(2266:2266)
      383442003996 0x2180 [0x30]: PERF_RECORD_EXIT(2268:2268):(2266:2266)
      383451297778 0xb70 [0x30]: PERF_RECORD_EXIT(2266:2266):(2265:2265)
      
      Fixes: 94d5d1b2
      
       ("perf_counter: Report the cloning task as parent on perf_counter_fork()")
      Reported-by: default avatarKP Singh <kpsingh@google.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20200417182842.12522-1-irogers@google.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed0e49c6
    • Jason Gunthorpe's avatar
      net/cxgb4: Check the return from t4_query_params properly · 024bb467
      Jason Gunthorpe authored
      commit c799fca8 upstream.
      
      Positive return values are also failures that don't set val,
      although this probably can't happen. Fixes gcc 10 warning:
      
      drivers/net/ethernet/chelsio/cxgb4/t4_hw.c: In function ‘t4_phy_fw_ver’:
      drivers/net/ethernet/chelsio/cxgb4/t4_hw.c:3747:14: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       3747 |  *phy_fw_ver = val;
      
      Fixes: 01b69614
      
       ("cxgb4: Add PHY firmware support for T420-BT cards")
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      024bb467
    • Vasily Averin's avatar
      nfsd: memory corruption in nfsd4_lock() · 0ebb0563
      Vasily Averin authored
      commit e1e8399e upstream.
      
      New struct nfsd4_blocked_lock allocated in find_or_allocate_block()
      does not initialized nbl_list and nbl_lru.
      If conflock allocation fails rollback can call list_del_init()
      access uninitialized fields and corrupt memory.
      
      v2: just initialize nbl_list and nbl_lru right after nbl allocation.
      
      Fixes: 76d348fa
      
       ("nfsd: have nfsd4_lock use blocking locks for v4.1+ lock")
      Signed-off-by: default avatarVasily Averin <vvs@virtuozzo.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0ebb0563
    • Nathan Chancellor's avatar
      usb: gadget: udc: bdc: Remove unnecessary NULL checks in bdc_req_complete · e75dc452
      Nathan Chancellor authored
      commit 09b04abb upstream.
      
      When building with Clang + -Wtautological-pointer-compare:
      
      drivers/usb/gadget/udc/bdc/bdc_ep.c:543:28: warning: comparison of
      address of 'req->queue' equal to a null pointer is always false
      [-Wtautological-pointer-compare]
              if (req == NULL  || &req->queue == NULL || &req->usb_req == NULL)
                                   ~~~~~^~~~~    ~~~~
      drivers/usb/gadget/udc/bdc/bdc_ep.c:543:51: warning: comparison of
      address of 'req->usb_req' equal to a null pointer is always false
      [-Wtautological-pointer-compare]
              if (req == NULL  || &req->queue == NULL || &req->usb_req == NULL)
                                                          ~~~~~^~~~~~~    ~~~~
      2 warnings generated.
      
      As it notes, these statements will always evaluate to false so remove
      them.
      
      Fixes: efed421a
      
       ("usb: gadget: Add UDC driver for Broadcom USB3.0 device controller IP BDC")
      Link: https://github.com/ClangBuiltLinux/linux/issues/749
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e75dc452
    • Liu Jian's avatar
      mtd: cfi: fix deadloop in cfi_cmdset_0002.c do_write_buffer · 54879852
      Liu Jian authored
      commit d9b8a67b upstream.
      
      In function do_write_buffer(), in the for loop, there is a case
      chip_ready() returns 1 while chip_good() returns 0, so it never
      break the loop.
      To fix this, chip_good() is enough and it should timeout if it stay
      bad for a while.
      
      Fixes: dfeae107
      
      ("mtd: cfi_cmdset_0002: Change write buffer to check correct value")
      Signed-off-by: default avatarYi Huaijie <yihuaijie@huawei.com>
      Signed-off-by: default avatarLiu Jian <liujian56@huawei.com>
      Reviewed-by: default avatarTokunori Ikegami <ikegami_to@yahoo.co.jp>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      54879852
    • Miklos Szeredi's avatar
      fuse: fix possibly missed wake-up after abort · 5aae6c46
      Miklos Szeredi authored
      commit 2d84a2d1
      
       upstream.
      
      In current fuse_drop_waiting() implementation it's possible that
      fuse_wait_aborted() will not be woken up in the unlikely case that
      fuse_abort_conn() + fuse_wait_aborted() runs in between checking
      fc->connected and calling atomic_dec(&fc->num_waiting).
      
      Do the atomic_dec_and_test() unconditionally, which also provides the
      necessary barrier against reordering with the fc->connected check.
      
      The explicit smp_mb() in fuse_wait_aborted() is not actually needed, since
      the spin_unlock() in fuse_abort_conn() provides the necessary RELEASE
      barrier after resetting fc->connected.  However, this is not a performance
      sensitive path, and adding the explicit barrier makes it easier to
      document.
      
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Fixes: b8f95e5d
      
       ("fuse: umount should wait for all requests")
      Cc: <stable@vger.kernel.org> #v4.19
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5aae6c46
    • Clement Leger's avatar
      remoteproc: Fix wrong rvring index computation · 8cb3f020
      Clement Leger authored
      commit 00a0eec5
      
       upstream.
      
      Index of rvring is computed using pointer arithmetic. However, since
      rvring->rvdev->vring is the base of the vring array, computation
      of rvring idx should be reversed. It previously lead to writing at negative
      indices in the resource table.
      
      Signed-off-by: default avatarClement Leger <cleger@kalray.eu>
      Link: https://lore.kernel.org/r/20191004073736.8327-1-cleger@kalray.eu
      Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Cc: Doug Anderson <dianders@chromium.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8cb3f020
    • Udipto Goswami's avatar
      usb: f_fs: Clear OS Extended descriptor counts to zero in ffs_data_reset() · d51a00db
      Udipto Goswami authored
      commit 1c2e54fb upstream.
      
      For userspace functions using OS Descriptors, if a function also supplies
      Extended Property descriptors currently the counts and lengths stored in
      the ms_os_descs_ext_prop_{count,name_len,data_len} variables are not
      getting reset to 0 during an unbind or when the epfiles are closed. If
      the same function is re-bound and the descriptors are re-written, this
      results in those count/length variables to monotonically increase
      causing the VLA allocation in _ffs_func_bind() to grow larger and larger
      at each bind/unbind cycle and eventually fail to allocate.
      
      Fix this by clearing the ms_os_descs_ext_prop count & lengths to 0 in
      ffs_data_reset().
      
      Fixes: f0175ab5
      
       ("usb: gadget: f_fs: OS descriptors support")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarUdipto Goswami <ugoswami@codeaurora.org>
      Signed-off-by: default avatarSriharsha Allenki <sallenki@codeaurora.org>
      Reviewed-by: default avatarManu Gautam <mgautam@codeaurora.org>
      Link: https://lore.kernel.org/r/20200402044521.9312-1-sallenki@codeaurora.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d51a00db
    • Oliver Neukum's avatar
      UAS: fix deadlock in error handling and PM flushing work · 2aac7290
      Oliver Neukum authored
      commit f6cc6093
      
       upstream.
      
      A SCSI error handler and block runtime PM must not allocate
      memory with GFP_KERNEL. Furthermore they must not wait for
      tasks allocating memory with GFP_KERNEL.
      That means that they cannot share a workqueue with arbitrary tasks.
      
      Fix this for UAS using a private workqueue.
      
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
      Fixes: f9dc024a
      
       ("uas: pre_reset and suspend: Fix a few races")
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200415141750.811-2-oneukum@suse.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2aac7290
    • Oliver Neukum's avatar
      UAS: no use logging any details in case of ENODEV · dbb65275
      Oliver Neukum authored
      commit 5963dec9
      
       upstream.
      
      Once a device is gone, the internal state does not matter anymore.
      There is no need to spam the logs.
      
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
      Cc: stable <stable@vger.kernel.org>
      Fixes: 326349f8
      
       ("uas: add dead request list")
      Link: https://lore.kernel.org/r/20200415141750.811-1-oneukum@suse.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dbb65275
    • Malcolm Priestley's avatar
      staging: vt6656: Power save stop wake_up_count wrap around. · 9e07de06
      Malcolm Priestley authored
      commit ea81c348 upstream.
      
      conf.listen_interval can sometimes be zero causing wake_up_count
      to wrap around up to many beacons too late causing
      CTRL-EVENT-BEACON-LOSS as in.
      
      wpa_supplicant[795]: message repeated 45 times: [..CTRL-EVENT-BEACON-LOSS ]
      
      Fixes: 43c93d9b
      
       ("staging: vt6656: implement power saving code.")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
      Link: https://lore.kernel.org/r/fce47bb5-7ca6-7671-5094-5c6107302f2b@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9e07de06
    • Malcolm Priestley's avatar
      staging: vt6656: Fix drivers TBTT timing counter. · b591ebec
      Malcolm Priestley authored
      commit 09057742 upstream.
      
      The drivers TBTT counter is not synchronized with mac80211 timestamp.
      
      Reorder the functions and use vnt_update_next_tbtt to do the final
      synchronize.
      
      Fixes: c1515879
      
       ("staging: vt6656: implement TSF counter")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
      Link: https://lore.kernel.org/r/375d0b25-e8bc-c8f7-9b10-6cc705d486ee@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b591ebec
    • Xiyu Yang's avatar
      staging: comedi: Fix comedi_device refcnt leak in comedi_open · 264274de
      Xiyu Yang authored
      commit 332e0e17 upstream.
      
      comedi_open() invokes comedi_dev_get_from_minor(), which returns a
      reference of the COMEDI device to "dev" with increased refcount.
      
      When comedi_open() returns, "dev" becomes invalid, so the refcount
      should be decreased to keep refcount balanced.
      
      The reference counting issue happens in one exception handling path of
      comedi_open(). When "cfp" allocation is failed, the refcnt increased by
      comedi_dev_get_from_minor() is not decreased, causing a refcnt leak.
      
      Fix this issue by calling comedi_dev_put() on this error path when "cfp"
      allocation is failed.
      
      Fixes: 20f083c0
      
       ("staging: comedi: prepare support for per-file read and write subdevices")
      Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Link: https://lore.kernel.org/r/1587361459-83622-1-git-send-email-xiyuyang19@fudan.edu.cn
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      264274de
    • Ian Abbott's avatar
      staging: comedi: dt2815: fix writing hi byte of analog output · 607dd7b7
      Ian Abbott authored
      commit ed87d33d
      
       upstream.
      
      The DT2815 analog output command is 16 bits wide, consisting of the
      12-bit sample value in bits 15 to 4, the channel number in bits 3 to 1,
      and a voltage or current selector in bit 0.  Both bytes of the 16-bit
      command need to be written in turn to a single 8-bit data register.
      However, the driver currently only writes the low 8-bits.  It is broken
      and appears to have always been broken.
      
      Electronic copies of the DT2815 User's Manual seem impossible to find
      online, but looking at the source code, a best guess for the sequence
      the driver intended to use to write the analog output command is as
      follows:
      
      1. Wait for the status register to read 0x00.
      2. Write the low byte of the command to the data register.
      3. Wait for the status register to read 0x80.
      4. Write the high byte of the command to the data register.
      
      Step 4 is missing from the driver.  Add step 4 to (hopefully) fix the
      driver.
      
      Also add a "FIXME" comment about setting bit 0 of the low byte of the
      command.  Supposedly, it is used to choose between voltage output and
      current output, but the current driver always sets it to 1.
      
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200406142015.126982-1-abbotti@mev.co.uk
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      607dd7b7
    • Ahmad Fatoum's avatar
      ARM: imx: provide v7_cpu_resume() only on ARM_CPU_SUSPEND=y · e454dc86
      Ahmad Fatoum authored
      commit f1baca88 upstream.
      
      512a928a ("ARM: imx: build v7_cpu_resume() unconditionally")
      introduced an unintended linker error for i.MX6 configurations that have
      ARM_CPU_SUSPEND=n which can happen if neither CONFIG_PM, CONFIG_CPU_IDLE,
      nor ARM_PSCI_FW are selected.
      
      Fix this by having v7_cpu_resume() compiled only when cpu_resume() it
      calls is available as well.
      
      The C declaration for the function remains unguarded to avoid future code
      inadvertently using a stub and introducing a regression to the bug the
      original commit fixed.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 512a928a
      
       ("ARM: imx: build v7_cpu_resume() unconditionally")
      Reported-by: default avatarClemens Gruber <clemens.gruber@pqgruber.com>
      Signed-off-by: default avatarAhmad Fatoum <a.fatoum@pengutronix.de>
      Tested-by: default avatarRoland Hieber <rhi@pengutronix.de>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e454dc86
    • Gyeongtaek Lee's avatar
      ASoC: dapm: fixup dapm kcontrol widget · 90c75e8c
      Gyeongtaek Lee authored
      commit ebf14747
      
       upstream.
      
      snd_soc_dapm_kcontrol widget which is created by autodisable control
      should contain correct on_val, mask and shift because it is set when the
      widget is powered and changed value is applied on registers by following
      code in dapm_seq_run_coalesced().
      
      		mask |= w->mask << w->shift;
      		if (w->power)
      			value |= w->on_val << w->shift;
      		else
      			value |= w->off_val << w->shift;
      
      Shift on the mask in dapm_kcontrol_data_alloc() is removed to prevent
      double shift.
      And, on_val in dapm_kcontrol_set_value() is modified to get correct
      value in the dapm_seq_run_coalesced().
      
      Signed-off-by: default avatarGyeongtaek Lee <gt82.lee@samsung.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/000001d61537$b212f620$1638e260$@samsung.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      90c75e8c
    • Paul Moore's avatar
      audit: check the length of userspace generated audit records · 3fb1c816
      Paul Moore authored
      commit 763dafc5 upstream.
      
      Commit 75612528 ("audit: always check the netlink payload length
      in audit_receive_msg()") fixed a number of missing message length
      checks, but forgot to check the length of userspace generated audit
      records.  The good news is that you need CAP_AUDIT_WRITE to submit
      userspace audit records, which is generally only given to trusted
      processes, so the impact should be limited.
      
      Cc: stable@vger.kernel.org
      Fixes: 75612528
      
       ("audit: always check the netlink payload length in audit_receive_msg()")
      Reported-by: default avatar <syzbot+49e69b4d71a420ceda3e@syzkaller.appspotmail.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3fb1c816
    • Alan Stern's avatar
      usb-storage: Add unusual_devs entry for JMicron JMS566 · be76ff05
      Alan Stern authored
      commit 94f9c8c3 upstream.
      
      Cyril Roelandt reports that his JMicron JMS566 USB-SATA bridge fails
      to handle WRITE commands with the FUA bit set, even though it claims
      to support FUA.  (Oddly enough, a later version of the same bridge,
      version 2.03 as opposed to 1.14, doesn't claim to support FUA.  Also
      oddly, the bridge _does_ support FUA when using the UAS transport
      instead of the Bulk-Only transport -- but this device was blacklisted
      for uas in commit bc3bdb12
      
       ("usb-storage: Disable UAS on JMicron
      SATA enclosure") for apparently unrelated reasons.)
      
      This patch adds a usb-storage unusual_devs entry with the BROKEN_FUA
      flag.  This allows the bridge to work properly with usb-storage.
      
      Reported-and-tested-by: default avatarCyril Roelandt <tipecaml@gmail.com>
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.2004221613110.11262-100000@iolanthe.rowland.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be76ff05
    • Jiri Slaby's avatar
      tty: rocket, avoid OOB access · 315ecf50
      Jiri Slaby authored
      commit 7127d243
      
       upstream.
      
      init_r_port can access pc104 array out of bounds. pc104 is a 2D array
      defined to have 4 members. Each member has 8 submembers.
      * we can have more than 4 (PCI) boards, i.e. [board] can be OOB
      * line is not modulo-ed by anything, so the first line on the second
        board can be 4, on the 3rd 12 or alike (depending on previously
        registered boards). It's zero only on the first line of the first
        board. So even [line] can be OOB, quite soon (with the 2nd registered
        board already).
      
      This code is broken for ages, so just avoid the OOB accesses and don't
      try to fix it as we would need to find out the correct line number. Use
      the default: RS232, if we are out.
      
      Generally, if anyone needs to set the interface types, a module parameter
      is past the last thing that should be used for this purpose. The
      parameters' description says it's for ISA cards anyway.
      
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: stable <stable@vger.kernel.org>
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Link: https://lore.kernel.org/r/20200417105959.15201-2-jslaby@suse.cz
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      315ecf50
    • Andrew Melnychenko's avatar
      tty: hvc: fix buffer overflow during hvc_alloc(). · 8ecdbc14
      Andrew Melnychenko authored
      commit 9a9fc42b
      
       upstream.
      
      If there is a lot(more then 16) of virtio-console devices
      or virtio_console module is reloaded
      - buffers 'vtermnos' and 'cons_ops' are overflowed.
      In older kernels it overruns spinlock which leads to kernel freezing:
      https://bugzilla.redhat.com/show_bug.cgi?id=1786239
      
      To reproduce the issue, you can try simple script that
      loads/unloads module. Something like this:
      while [ 1 ]
      do
        modprobe virtio_console
        sleep 2
        modprobe -r virtio_console
        sleep 2
      done
      
      Description of problem:
      Guest get 'Call Trace' when loading module "virtio_console"
      and unloading it frequently - clearly reproduced on kernel-4.18.0:
      
      [   81.498208] ------------[ cut here ]------------
      [   81.499263] pvqspinlock: lock 0xffffffff92080020 has corrupted value 0xc0774ca0!
      [   81.501000] WARNING: CPU: 0 PID: 785 at kernel/locking/qspinlock_paravirt.h:500 __pv_queued_spin_unlock_slowpath+0xc0/0xd0
      [   81.503173] Modules linked in: virtio_console fuse xt_CHECKSUM ipt_MASQUERADE xt_conntrack ipt_REJECT nft_counter nf_nat_tftp nft_objref nf_conntrack_tftp tun bridge stp llc nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nf_tables_set nft_chain_nat_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 nft_chain_route_ipv6 nft_chain_nat_ipv4 nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack nft_chain_route_ipv4 ip6_tables nft_compat ip_set nf_tables nfnetlink sunrpc bochs_drm drm_vram_helper ttm drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm i2c_piix4 pcspkr crct10dif_pclmul crc32_pclmul joydev ghash_clmulni_intel ip_tables xfs libcrc32c sd_mod sg ata_generic ata_piix virtio_net libata crc32c_intel net_failover failover serio_raw virtio_scsi dm_mirror dm_region_hash dm_log dm_mod [last unloaded: virtio_console]
      [   81.517019] CPU: 0 PID: 785 Comm: kworker/0:2 Kdump: loaded Not tainted 4.18.0-167.el8.x86_64 #1
      [   81.518639] Hardware name: Red Hat KVM, BIOS 1.12.0-5.scrmod+el8.2.0+5159+d8aa4d83 04/01/2014
      [   81.520205] Workqueue: events control_work_handler [virtio_console]
      [   81.521354] RIP: 0010:__pv_queued_spin_unlock_slowpath+0xc0/0xd0
      [   81.522450] Code: 07 00 48 63 7a 10 e8 bf 64 f5 ff 66 90 c3 8b 05 e6 cf d6 01 85 c0 74 01 c3 8b 17 48 89 fe 48 c7 c7 38 4b 29 91 e8 3a 6c fa ff <0f> 0b c3 0f 0b 90 90 90 90 90 90 90 90 90 90 90 0f 1f 44 00 00 48
      [   81.525830] RSP: 0018:ffffb51a01ffbd70 EFLAGS: 00010282
      [   81.526798] RAX: 0000000000000000 RBX: 0000000000000010 RCX: 0000000000000000
      [   81.528110] RDX: ffff9e66f1826480 RSI: ffff9e66f1816a08 RDI: ffff9e66f1816a08
      [   81.529437] RBP: ffffffff9153ff10 R08: 000000000000026c R09: 0000000000000053
      [   81.530732] R10: 0000000000000000 R11: ffffb51a01ffbc18 R12: ffff9e66cd682200
      [   81.532133] R13: ffffffff9153ff10 R14: ffff9e6685569500 R15: ffff9e66cd682000
      [   81.533442] FS:  0000000000000000(0000) GS:ffff9e66f1800000(0000) knlGS:0000000000000000
      [   81.534914] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   81.535971] CR2: 00005624c55b14d0 CR3: 00000003a023c000 CR4: 00000000003406f0
      [   81.537283] Call Trace:
      [   81.537763]  __raw_callee_save___pv_queued_spin_unlock_slowpath+0x11/0x20
      [   81.539011]  .slowpath+0x9/0xe
      [   81.539585]  hvc_alloc+0x25e/0x300
      [   81.540237]  init_port_console+0x28/0x100 [virtio_console]
      [   81.541251]  handle_control_message.constprop.27+0x1c4/0x310 [virtio_console]
      [   81.542546]  control_work_handler+0x70/0x10c [virtio_console]
      [   81.543601]  process_one_work+0x1a7/0x3b0
      [   81.544356]  worker_thread+0x30/0x390
      [   81.545025]  ? create_worker+0x1a0/0x1a0
      [   81.545749]  kthread+0x112/0x130
      [   81.546358]  ? kthread_flush_work_fn+0x10/0x10
      [   81.547183]  ret_from_fork+0x22/0x40
      [   81.547842] ---[ end trace aa97649bd16c8655 ]---
      [   83.546539] general protection fault: 0000 [#1] SMP NOPTI
      [   83.547422] CPU: 5 PID: 3225 Comm: modprobe Kdump: loaded Tainted: G        W        --------- -  - 4.18.0-167.el8.x86_64 #1
      [   83.549191] Hardware name: Red Hat KVM, BIOS 1.12.0-5.scrmod+el8.2.0+5159+d8aa4d83 04/01/2014
      [   83.550544] RIP: 0010:__pv_queued_spin_lock_slowpath+0x19a/0x2a0
      [   83.551504] Code: c4 c1 ea 12 41 be 01 00 00 00 4c 8d 6d 14 41 83 e4 03 8d 42 ff 49 c1 e4 05 48 98 49 81 c4 40 a5 02 00 4c 03 24 c5 60 48 34 91 <49> 89 2c 24 b8 00 80 00 00 eb 15 84 c0 75 0a 41 0f b6 54 24 14 84
      [   83.554449] RSP: 0018:ffffb51a0323fdb0 EFLAGS: 00010202
      [   83.555290] RAX: 000000000000301c RBX: ffffffff92080020 RCX: 0000000000000001
      [   83.556426] RDX: 000000000000301d RSI: 0000000000000000 RDI: 0000000000000000
      [   83.557556] RBP: ffff9e66f196a540 R08: 000000000000028a R09: ffff9e66d2757788
      [   83.558688] R10: 0000000000000000 R11: 0000000000000000 R12: 646e61725f770b07
      [   83.559821] R13: ffff9e66f196a554 R14: 0000000000000001 R15: 0000000000180000
      [   83.560958] FS:  00007fd5032e8740(0000) GS:ffff9e66f1940000(0000) knlGS:0000000000000000
      [   83.562233] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   83.563149] CR2: 00007fd5022b0da0 CR3: 000000038c334000 CR4: 00000000003406e0
      
      Signed-off-by: default avatarAndrew Melnychenko <andrew@daynix.com>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200414191503.3471783-1-andrew@daynix.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8ecdbc14
    • Uros Bizjak's avatar
      KVM: VMX: Enable machine check support for 32bit targets · f497d009
      Uros Bizjak authored
      commit fb56baae upstream.
      
      There is no reason to limit the use of do_machine_check
      to 64bit targets. MCE handling works for both target familes.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Sean Christopherson <sean.j.christopherson@intel.com>
      Cc: stable@vger.kernel.org
      Fixes: a0861c02
      
       ("KVM: Add VT-x machine check support")
      Signed-off-by: default avatarUros Bizjak <ubizjak@gmail.com>
      Message-Id: <20200414071414.45636-1-ubizjak@gmail.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f497d009
    • Sean Christopherson's avatar
      KVM: Check validity of resolved slot when searching memslots · a57c01c5
      Sean Christopherson authored
      commit b6467ab1 upstream.
      
      Check that the resolved slot (somewhat confusingly named 'start') is a
      valid/allocated slot before doing the final comparison to see if the
      specified gfn resides in the associated slot.  The resolved slot can be
      invalid if the binary search loop terminated because the search index
      was incremented beyond the number of used slots.
      
      This bug has existed since the binary search algorithm was introduced,
      but went unnoticed because KVM statically allocated memory for the max
      number of slots, i.e. the access would only be truly out-of-bounds if
      all possible slots were allocated and the specified gfn was less than
      the base of the lowest memslot.  Commit 36947254 ("KVM: Dynamically
      size memslot array based on number of used slots") eliminated the "all
      possible slots allocated" condition and made the bug embarrasingly easy
      to hit.
      
      Fixes: 9c1a5d38
      
       ("kvm: optimize GFN to memslot lookup with large slots amount")
      Reported-by: default avatar <syzbot+d889b59b2bb87d4047a2@syzkaller.appspotmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
      Message-Id: <20200408064059.8957-2-sean.j.christopherson@intel.com>
      Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a57c01c5
    • Jarkko Sakkinen's avatar
      tpm/tpm_tis: Free IRQ if probing fails · e1022704
      Jarkko Sakkinen authored
      commit b160c94b
      
       upstream.
      
      Call disable_interrupts() if we have to revert to polling in order not to
      unnecessarily reserve the IRQ for the life-cycle of the driver.
      
      Cc: stable@vger.kernel.org # 4.5.x
      Reported-by: default avatarHans de Goede <hdegoede@redhat.com>
      Fixes: e3837e74
      
       ("tpm_tis: Refactor the interrupt setup")
      Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e1022704
    • Alexander Tsoy's avatar
      ALSA: usb-audio: Filter out unsupported sample rates on Focusrite devices · b0fb9cbf
      Alexander Tsoy authored
      commit 1c826792
      
       upstream.
      
      Many Focusrite devices supports a limited set of sample rates per
      altsetting. These includes audio interfaces with ADAT ports:
       - Scarlett 18i6, 18i8 1st gen, 18i20 1st gen;
       - Scarlett 18i8 2nd gen, 18i20 2nd gen;
       - Scarlett 18i8 3rd gen, 18i20 3rd gen;
       - Clarett 2Pre USB, 4Pre USB, 8Pre USB.
      
      Maximum rate is exposed in the last 4 bytes of Format Type descriptor
      which has a non-standard bLength = 10.
      
      Tested-by: default avatarAlexey Skobkin <skobkin-ru@ya.ru>
      Signed-off-by: default avatarAlexander Tsoy <alexander@tsoy.me>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200418175815.12211-1-alexander@tsoy.me
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b0fb9cbf