1. 28 Mar, 2018 40 commits
    • Toshi Kani's avatar
      mm/vmalloc: add interfaces to free unmapped page table · acdb4981
      Toshi Kani authored
      commit b6bdb751 upstream.
      
      On architectures with CONFIG_HAVE_ARCH_HUGE_VMAP set, ioremap() may
      create pud/pmd mappings.  A kernel panic was observed on arm64 systems
      with Cortex-A75 in the following steps as described by Hanjun Guo.
      
       1. ioremap a 4K size, valid page table will build,
       2. iounmap it, pte0 will set to 0;
       3. ioremap the same address with 2M size, pgd/pmd is unchanged,
          then set the a new value for pmd;
       4. pte0 is leaked;
       5. CPU may meet exception because the old pmd is still in TLB,
          which will lead to kernel panic.
      
      This panic is not reproducible on x86.  INVLPG, called from iounmap,
      purges all levels of entries associated with purged address on x86.  x86
      still has memory leak.
      
      The patch changes the ioremap path to free unmapped page table(s) since
      doing so in the unmap path has the following issues:
      
       - The iounmap() path is shared with vunmap(). Since vmap() only
         supports pte mappings, making vunmap() to free a pte page is an
         overhead for regular vmap users as they do not need a pte page freed
         up.
      
       - Checking if all entries in a pte page are cleared in the unmap path
         is racy, and serializing this check is expensive.
      
       - The unmap path calls free_vmap_area_noflush() to do lazy TLB purges.
         Clearing a pud/pmd entry before the lazy TLB purges needs extra TLB
         purge.
      
      Add two interfaces, pud_free_pmd_page() and pmd_free_pte_page(), which
      clear a given pud/pmd entry and free up a page for the lower level
      entries.
      
      This patch implements their stub functions on x86 and arm64, which work
      as workaround.
      
      [akpm@linux-foundation.org: fix typo in pmd_free_pte_page() stub]
      Link: http://lkml.kernel.org/r/20180314180155.19492-2-toshi.kani@hpe.com
      Fixes: e61ce6ad ("mm: change ioremap to set up huge I/O mappings")
      Reported-by: default avatarLei Li <lious.lilei@hisilicon.com>
      Signed-off-by: default avatarToshi Kani <toshi.kani@hpe.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Wang Xuefeng <wxf.wang@hisilicon.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Chintan Pandya <cpandya@codeaurora.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      acdb4981
    • Arnd Bergmann's avatar
      h8300: remove extraneous __BIG_ENDIAN definition · 04d47fc4
      Arnd Bergmann authored
      commit 1705f7c5 upstream.
      
      A bugfix I did earlier caused a build regression on h8300, which defines
      the __BIG_ENDIAN macro in a slightly different way than the generic
      code:
      
        arch/h8300/include/asm/byteorder.h:5:0: warning: "__BIG_ENDIAN" redefined
      
      We don't need to define it here, as the same macro is already provided
      by the linux/byteorder/big_endian.h, and that version does not conflict.
      
      While this is a v4.16 regression, my earlier patch also got backported
      to the 4.14 and 4.15 stable kernels, so we need the fixup there as well.
      
      Link: http://lkml.kernel.org/r/20180313120752.2645129-1-arnd@arndb.de
      Fixes: 101110f6 ("Kbuild: always define endianess in kconfig.h")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      04d47fc4
    • Mike Kravetz's avatar
      hugetlbfs: check for pgoff value overflow · 1e862844
      Mike Kravetz authored
      commit 63489f8e upstream.
      
      A vma with vm_pgoff large enough to overflow a loff_t type when
      converted to a byte offset can be passed via the remap_file_pages system
      call.  The hugetlbfs mmap routine uses the byte offset to calculate
      reservations and file size.
      
      A sequence such as:
      
        mmap(0x20a00000, 0x600000, 0, 0x66033, -1, 0);
        remap_file_pages(0x20a00000, 0x600000, 0, 0x20000000000000, 0);
      
      will result in the following when task exits/file closed,
      
        kernel BUG at mm/hugetlb.c:749!
        Call Trace:
          hugetlbfs_evict_inode+0x2f/0x40
          evict+0xcb/0x190
          __dentry_kill+0xcb/0x150
          __fput+0x164/0x1e0
          task_work_run+0x84/0xa0
          exit_to_usermode_loop+0x7d/0x80
          do_syscall_64+0x18b/0x190
          entry_SYSCALL_64_after_hwframe+0x3d/0xa2
      
      The overflowed pgoff value causes hugetlbfs to try to set up a mapping
      with a negative range (end < start) that leaves invalid state which
      causes the BUG.
      
      The previous overflow fix to this code was incomplete and did not take
      the remap_file_pages system call into account.
      
      [mike.kravetz@oracle.com: v3]
        Link: http://lkml.kernel.org/r/20180309002726.7248-1-mike.kravetz@oracle.com
      [akpm@linux-foundation.org: include mmdebug.h]
      [akpm@linux-foundation.org: fix -ve left shift count on sh]
      Link: http://lkml.kernel.org/r/20180308210502.15952-1-mike.kravetz@oracle.com
      Fixes: 045c7a3f ("hugetlbfs: fix offset overflow in hugetlbfs mmap")
      Signed-off-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
      Reported-by: default avatarNic Losby <blurbdust@gmail.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Yisheng Xie <xieyisheng1@huawei.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1e862844
    • Jeff Layton's avatar
      nfsd: remove blocked locks on client teardown · 797bfd05
      Jeff Layton authored
      commit 68ef3bc3 upstream.
      
      We had some reports of panics in nfsd4_lm_notify, and that showed a
      nfs4_lockowner that had outlived its so_client.
      
      Ensure that we walk any leftover lockowners after tearing down all of
      the stateids, and remove any blocked locks that they hold.
      
      With this change, we also don't need to walk the nbl_lru on nfsd_net
      shutdown, as that will happen naturally when we tear down the clients.
      
      Fixes: 76d348fa (nfsd: have nfsd4_lock use blocking locks for v4.1+ locks)
      Reported-by: default avatarFrank Sorenson <fsorenso@redhat.com>
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Cc: stable@vger.kernel.org # 4.9
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      797bfd05
    • Tejun Heo's avatar
      cgroup: fix rule checking for threaded mode switching · aa0533f4
      Tejun Heo authored
      commit d1897c95 upstream.
      
      A domain cgroup isn't allowed to be turned threaded if its subtree is
      populated or domain controllers are enabled.  cgroup_enable_threaded()
      depended on cgroup_can_be_thread_root() test to enforce this rule.  A
      parent which has populated domain descendants or have domain
      controllers enabled can't become a thread root, so the above rules are
      enforced automatically.
      
      However, for the root cgroup which can host mixed domain and threaded
      children, cgroup_can_be_thread_root() doesn't check any of those
      conditions and thus first level cgroups ends up escaping those rules.
      
      This patch fixes the bug by adding explicit checks for those rules in
      cgroup_enable_threaded().
      Reported-by: default avatarMichael Kerrisk (man-pages) <mtk.manpages@gmail.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Fixes: 8cfd8147 ("cgroup: implement cgroup v2 thread support")
      Cc: stable@vger.kernel.org # v4.14+
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa0533f4
    • Hans de Goede's avatar
      libata: Modify quirks for MX100 to limit NCQ_TRIM quirk to MU01 version · 2b4bb9f3
      Hans de Goede authored
      commit d418ff56 upstream.
      
      When commit 9c7be59f ("libata: Apply NOLPM quirk to Crucial MX100
      512GB SSDs") was added it inherited the ATA_HORKAGE_NO_NCQ_TRIM quirk
      from the existing "Crucial_CT*MX100*" entry, but that entry sets model_rev
      to "MU01", where as the entry adding the NOLPM quirk sets it to NULL.
      
      This means that after this commit we no apply the NO_NCQ_TRIM quirk to
      all "Crucial_CT512MX100*" SSDs even if they have the fixed "MU02"
      firmware. This commit splits the "Crucial_CT512MX100*" quirk into 2
      quirks, one for the "MU01" firmware and one for all other firmware
      versions, so that we once again only apply the NO_NCQ_TRIM quirk to the
      "MU01" firmware version.
      
      Fixes: 9c7be59f ("libata: Apply NOLPM quirk to ... MX100 512GB SSDs")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2b4bb9f3
    • Hans de Goede's avatar
      libata: Make Crucial BX100 500GB LPM quirk apply to all firmware versions · 65ab5809
      Hans de Goede authored
      commit 3bf7b5d6 upstream.
      
      Commit b17e5729 ("libata: disable LPM for Crucial BX100 SSD 500GB
      drive"), introduced a ATA_HORKAGE_NOLPM quirk for Crucial BX100 500GB SSDs
      but limited this to the MU02 firmware version, according to:
      http://www.crucial.com/usa/en/support-ssd-firmware
      
      MU02 is the last version, so there are no newer possibly fixed versions
      and if the MU02 version has broken LPM then the MU01 almost certainly
      also has broken LPM, so this commit changes the quirk to apply to all
      firmware versions.
      
      Fixes: b17e5729 ("libata: disable LPM for Crucial BX100 SSD 500GB...")
      Cc: stable@vger.kernel.org
      Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      65ab5809
    • Hans de Goede's avatar
      libata: Apply NOLPM quirk to Crucial M500 480 and 960GB SSDs · 596d0a8e
      Hans de Goede authored
      commit 62ac3f73 upstream.
      
      There have been reports of the Crucial M500 480GB model not working
      with LPM set to min_power / med_power_with_dipm level.
      
      It has not been tested with medium_power, but that typically has no
      measurable power-savings.
      
      Note the reporters Crucial_CT480M500SSD3 has a firmware version of MU03
      and there is a MU05 update available, but that update does not mention any
      LPM fixes in its changelog, so the quirk matches all firmware versions.
      
      In my experience the LPM problems with (older) Crucial SSDs seem to be
      limited to higher capacity versions of the SSDs (different firmware?),
      so this commit adds a NOLPM quirk for the 480 and 960GB versions of the
      M500, to avoid LPM causing issues with these SSDs.
      
      Cc: stable@vger.kernel.org
      Reported-and-tested-by: default avatarMartin Steigerwald <martin@lichtvoll.de>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      596d0a8e
    • Ju Hyung Park's avatar
      libata: Enable queued TRIM for Samsung SSD 860 · 01b6d683
      Ju Hyung Park authored
      commit ca6bfcb2 upstream.
      
      Samsung explicitly states that queued TRIM is supported for Linux with
      860 PRO and 860 EVO.
      
      Make the previous blacklist to cover only 840 and 850 series.
      Signed-off-by: default avatarPark Ju Hyung <qkrwngud825@gmail.com>
      Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      01b6d683
    • Kai-Heng Feng's avatar
      libata: disable LPM for Crucial BX100 SSD 500GB drive · 603f0168
      Kai-Heng Feng authored
      commit b17e5729 upstream.
      
      After Laptop Mode Tools starts to use min_power for LPM, a user found
      out Crucial BX100 SSD can't get mounted.
      
      Crucial BX100 SSD 500GB drive don't work well with min_power. This also
      happens to med_power_with_dipm.
      
      So let's disable LPM for Crucial BX100 SSD 500GB drive.
      
      BugLink: https://bugs.launchpad.net/bugs/1726930Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      603f0168
    • Hans de Goede's avatar
      libata: Apply NOLPM quirk to Crucial MX100 512GB SSDs · 3962dd60
      Hans de Goede authored
      commit 9c7be59f upstream.
      
      Various people have reported the Crucial MX100 512GB model not working
      with LPM set to min_power. I've now received a report that it also does
      not work with the new med_power_with_dipm level.
      
      It does work with medium_power, but that has no measurable power-savings
      and given the amount of people being bitten by the other levels not
      working, this commit just disables LPM altogether.
      
      Note all reporters of this have either the 512GB model (max capacity), or
      are not specifying their SSD's size. So for now this quirk assumes this is
      a problem with the 512GB model only.
      
      Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=89261
      Buglink: https://github.com/linrunner/TLP/issues/84
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3962dd60
    • Eric Biggers's avatar
      libata: don't try to pass through NCQ commands to non-NCQ devices · 5e67e65d
      Eric Biggers authored
      commit 2c1ec6fd upstream.
      
      syzkaller hit a WARN() in ata_bmdma_qc_issue() when writing to /dev/sg0.
      This happened because it issued an ATA pass-through command (ATA_16)
      where the protocol field indicated that NCQ should be used -- but the
      device did not support NCQ.
      
      We could just remove the WARN() from libata-sff.c, but the real problem
      seems to be that the SCSI -> ATA translation code passes through NCQ
      commands without verifying that the device actually supports NCQ.
      
      Fix this by adding the appropriate check to ata_scsi_pass_thru().
      
      Here's reproducer that works in QEMU when /dev/sg0 refers to a disk of
      the default type ("82371SB PIIX3 IDE"):
      
          #include <fcntl.h>
          #include <unistd.h>
      
          int main()
          {
                  char buf[53] = { 0 };
      
      	    buf[36] = 0x85;		/* ATA_16 */
      	    buf[37] = (12 << 1);	/* FPDMA */
      	    buf[38] = 0x1;		/* Has data */
      	    buf[51] = 0xC8;		/* ATA_CMD_READ */
                  write(open("/dev/sg0", O_RDWR), buf, sizeof(buf));
          }
      
      Fixes: ee7fb331 ("libata: add support for NCQ commands for SG interface")
      Reported-by: syzbot+2f69ca28df61bdfc77cd36af2e789850355a221e@syzkaller.appspotmail.com
      Cc: <stable@vger.kernel.org> # v4.4+
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5e67e65d
    • Eric Biggers's avatar
      libata: remove WARN() for DMA or PIO command without data · cd47a2cc
      Eric Biggers authored
      commit 9173e5e8 upstream.
      
      syzkaller hit a WARN() in ata_qc_issue() when writing to /dev/sg0.  This
      happened because it issued a READ_6 command with no data buffer.
      
      Just remove the WARN(), as it doesn't appear indicate a kernel bug.  The
      expected behavior is to fail the command, which the code does.
      
      Here's a reproducer that works in QEMU when /dev/sg0 refers to a disk of
      the default type ("82371SB PIIX3 IDE"):
      
          #include <fcntl.h>
          #include <unistd.h>
      
          int main()
          {
                  char buf[42] = { [36] = 0x8 /* READ_6 */ };
      
                  write(open("/dev/sg0", O_RDWR), buf, sizeof(buf));
          }
      
      Fixes: f92a2636 ("libata: change ATA_QCFLAG_DMAMAP semantics")
      Reported-by: syzbot+f7b556d1766502a69d85071d2ff08bd87be53d0f@syzkaller.appspotmail.com
      Cc: <stable@vger.kernel.org> # v2.6.25+
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cd47a2cc
    • Eric Biggers's avatar
      libata: fix length validation of ATAPI-relayed SCSI commands · 8745d206
      Eric Biggers authored
      commit 058f58e2 upstream.
      
      syzkaller reported a crash in ata_bmdma_fill_sg() when writing to
      /dev/sg1.  The immediate cause was that the ATA command's scatterlist
      was not DMA-mapped, which causes 'pi - 1' to underflow, resulting in a
      write to 'qc->ap->bmdma_prd[0xffffffff]'.
      
      Strangely though, the flag ATA_QCFLAG_DMAMAP was set in qc->flags.  The
      root cause is that when __ata_scsi_queuecmd() is preparing to relay a
      SCSI command to an ATAPI device, it doesn't correctly validate the CDB
      length before copying it into the 16-byte buffer 'cdb' in 'struct
      ata_queued_cmd'.  Namely, it validates the fixed CDB length expected
      based on the SCSI opcode but not the actual CDB length, which can be
      larger due to the use of the SG_NEXT_CMD_LEN ioctl.  Since 'flags' is
      the next member in ata_queued_cmd, a buffer overflow corrupts it.
      
      Fix it by requiring that the actual CDB length be <= 16 (ATAPI_CDB_LEN).
      
      [Really it seems the length should be required to be <= dev->cdb_len,
      but the current behavior seems to have been intentionally introduced by
      commit 607126c2 ("libata-scsi: be tolerant of 12-byte ATAPI commands
      in 16-byte CDBs") to work around a userspace bug in mplayer.  Probably
      the workaround is no longer needed (mplayer was fixed in 2007), but
      continuing to allow lengths to up 16 appears harmless for now.]
      
      Here's a reproducer that works in QEMU when /dev/sg1 refers to the
      CD-ROM drive that qemu-system-x86_64 creates by default:
      
          #include <fcntl.h>
          #include <sys/ioctl.h>
          #include <unistd.h>
      
          #define SG_NEXT_CMD_LEN 0x2283
      
          int main()
          {
      	    char buf[53] = { [36] = 0x7e, [52] = 0x02 };
      	    int fd = open("/dev/sg1", O_RDWR);
      	    ioctl(fd, SG_NEXT_CMD_LEN, &(int){ 17 });
      	    write(fd, buf, sizeof(buf));
          }
      
      The crash was:
      
          BUG: unable to handle kernel paging request at ffff8cb97db37ffc
          IP: ata_bmdma_fill_sg drivers/ata/libata-sff.c:2623 [inline]
          IP: ata_bmdma_qc_prep+0xa4/0xc0 drivers/ata/libata-sff.c:2727
          PGD fb6c067 P4D fb6c067 PUD 0
          Oops: 0002 [#1] SMP
          CPU: 1 PID: 150 Comm: syz_ata_bmdma_q Not tainted 4.15.0-next-20180202 #99
          Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-20171110_100015-anatol 04/01/2014
          [...]
          Call Trace:
           ata_qc_issue+0x100/0x1d0 drivers/ata/libata-core.c:5421
           ata_scsi_translate+0xc9/0x1a0 drivers/ata/libata-scsi.c:2024
           __ata_scsi_queuecmd drivers/ata/libata-scsi.c:4326 [inline]
           ata_scsi_queuecmd+0x8c/0x210 drivers/ata/libata-scsi.c:4375
           scsi_dispatch_cmd+0xa2/0xe0 drivers/scsi/scsi_lib.c:1727
           scsi_request_fn+0x24c/0x530 drivers/scsi/scsi_lib.c:1865
           __blk_run_queue_uncond block/blk-core.c:412 [inline]
           __blk_run_queue+0x3a/0x60 block/blk-core.c:432
           blk_execute_rq_nowait+0x93/0xc0 block/blk-exec.c:78
           sg_common_write.isra.7+0x272/0x5a0 drivers/scsi/sg.c:806
           sg_write+0x1ef/0x340 drivers/scsi/sg.c:677
           __vfs_write+0x31/0x160 fs/read_write.c:480
           vfs_write+0xa7/0x160 fs/read_write.c:544
           SYSC_write fs/read_write.c:589 [inline]
           SyS_write+0x4d/0xc0 fs/read_write.c:581
           do_syscall_64+0x5e/0x110 arch/x86/entry/common.c:287
           entry_SYSCALL_64_after_hwframe+0x21/0x86
      
      Fixes: 607126c2 ("libata-scsi: be tolerant of 12-byte ATAPI commands in 16-byte CDBs")
      Reported-by: syzbot+1ff6f9fcc3c35f1c72a95e26528c8e7e3276e4da@syzkaller.appspotmail.com
      Cc: <stable@vger.kernel.org> # v2.6.24+
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8745d206
    • Takashi Iwai's avatar
      Bluetooth: btusb: Fix quirk for Atheros 1525/QCA6174 · 15a4417c
      Takashi Iwai authored
      commit f44cb4b1 upstream.
      
      The Atheros 1525/QCA6174 BT doesn't seem working properly on the
      recent kernels, as it tries to load a wrong firmware
      ar3k/AthrBT_0x00000200.dfu and it fails.
      
      This seems to have been a problem for some time, and the known
      workaround is to apply BTUSB_QCA_ROM quirk instead of BTUSB_ATH3012.
      
      The device in question is:
      
      T: Bus=01 Lev=01 Prnt=01 Port=09 Cnt=03 Dev#=  4 Spd=12   MxCh= 0
      D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P: Vendor=0cf3 ProdID=3004 Rev= 0.01
      C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E: Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
      E: Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      E: Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E: Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      E: Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E: Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      E: Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E: Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      E: Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E: Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      E: Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E: Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      E: Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E: Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      E: Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      
      Bugzilla: http://bugzilla.opensuse.org/show_bug.cgi?id=1082504Reported-by: default avatarIvan Levshin <ivan.levshin@microfocus.com>
      Tested-by: default avatarIvan Levshin <ivan.levshin@microfocus.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      15a4417c
    • Kai-Heng Feng's avatar
      Bluetooth: btusb: Add Dell OptiPlex 3060 to btusb_needs_reset_resume_table · cd3141c0
      Kai-Heng Feng authored
      commit 0c6e5266 upstream.
      
      The issue can be reproduced before commit fd865802 ("Bluetooth:
      btusb: fix QCA Rome suspend/resume") gets introduced, so the reset
      resume quirk is still needed for this system.
      
      T:  Bus=01 Lev=01 Prnt=01 Port=13 Cnt=01 Dev#=  4 Spd=12  MxCh= 0
      D:  Ver= 2.01 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=0cf3 ProdID=e007 Rev=00.01
      C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
      I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      
      Cc: stable@vger.kernel.org
      Cc: Brian Norris <briannorris@chromium.org>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cd3141c0
    • Hans de Goede's avatar
      Bluetooth: btusb: Remove Yoga 920 from the btusb_needs_reset_resume_table · 3a64bcc3
      Hans de Goede authored
      commit f0e8c611 upstream.
      
      Commit 1fdb9269 ("Bluetooth: btusb: Use DMI matching for QCA
      reset_resume quirking"), added the Lenovo Yoga 920 to the
      btusb_needs_reset_resume_table.
      
      Testing has shown that this is a false positive and the problems where
      caused by issues with the initial fix: commit fd865802 ("Bluetooth:
      btusb: fix QCA Rome suspend/resume"), which has already been reverted.
      
      So the QCA Rome BT in the Yoga 920 does not need a reset-resume quirk at
      all and this commit removes it from the btusb_needs_reset_resume_table.
      
      Note that after this commit the btusb_needs_reset_resume_table is now
      empty. It is kept around on purpose, since this whole series of commits
      started for a reason and there are actually broken platforms around,
      which need to be added to it.
      
      BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1514836
      Fixes: 1fdb9269 ("Bluetooth: btusb: Use DMI matching for QCA ...")
      Cc: stable@vger.kernel.org
      Cc: Brian Norris <briannorris@chromium.org>
      Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
      Tested-by: default avatarKevin Fenzi <kevin@scrye.com>
      Suggested-by: default avatarBrian Norris <briannorris@chromium.org>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Reviewed-by: default avatarBrian Norris <briannorris@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3a64bcc3
    • Krzysztof Kozlowski's avatar
      pinctrl: samsung: Validate alias coming from DT · b64ffeec
      Krzysztof Kozlowski authored
      commit 93b0beae upstream.
      
      Driver uses alias from Device Tree as an index of pin controller data
      array.  In case of a wrong DTB or an out-of-tree DTB, the alias could be
      outside of this data array leading to out-of-bounds access.
      
      Depending on binary and memory layout, this could be handled properly
      (showing error like "samsung-pinctrl 3860000.pinctrl: driver data not
      available") or could lead to exceptions.
      Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Cc: <stable@vger.kernel.org>
      Fixes: 30574f0d ("pinctrl: add samsung pinctrl and gpiolib driver")
      Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Acked-by: default avatarTomasz Figa <tomasz.figa@gmail.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b64ffeec
    • Michael Kelley's avatar
      Drivers: hv: vmbus: Fix ring buffer signaling · a1da0548
      Michael Kelley authored
      commit 655296c8 upstream.
      
      Fix bugs in signaling the Hyper-V host when freeing space in the
      host->guest ring buffer:
      
      1. The interrupt_mask must not be used to determine whether to signal
         on the host->guest ring buffer
      2. The ring buffer write_index must be read (via hv_get_bytes_to_write)
         *after* pending_send_sz is read in order to avoid a race condition
      3. Comparisons with pending_send_sz must treat the "equals" case as
         not-enough-space
      4. Don't signal if the pending_send_sz feature is not present. Older
         versions of Hyper-V that don't implement this feature will poll.
      
      Fixes: 03bad714 ("vmbus: more host signalling avoidance")
      
      Cc: Stable <stable@vger.kernel.org> # 4.14 and above
      Signed-off-by: default avatarMichael Kelley <mhkelley@outlook.com>
      Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a1da0548
    • Leon Romanovsky's avatar
      RDMA/mlx5: Fix crash while accessing garbage pointer and freed memory · 8f59abbd
      Leon Romanovsky authored
      commit f3f134f5 upstream.
      
      The failure in rereg_mr flow caused to set garbage value (error value)
      into mr->umem pointer. This pointer is accessed at the release stage
      and it causes to the following crash.
      
      There is not enough to simply change umem to point to NULL, because the
      MR struct is needed to be accessed during MR deregistration phase, so
      delay kfree too.
      
      [    6.237617] BUG: unable to handle kernel NULL pointer dereference a 0000000000000228
      [    6.238756] IP: ib_dereg_mr+0xd/0x30
      [    6.239264] PGD 80000000167eb067 P4D 80000000167eb067 PUD 167f9067 PMD 0
      [    6.240320] Oops: 0000 [#1] SMP PTI
      [    6.240782] CPU: 0 PID: 367 Comm: dereg Not tainted 4.16.0-rc1-00029-gc198fafe0453 #183
      [    6.242120] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-0-ge51488c-20140602_164612-nilsson.home.kraxel.org 04/01/2014
      [    6.244504] RIP: 0010:ib_dereg_mr+0xd/0x30
      [    6.245253] RSP: 0018:ffffaf5d001d7d68 EFLAGS: 00010246
      [    6.246100] RAX: 0000000000000000 RBX: ffff95d4172daf00 RCX: 0000000000000000
      [    6.247414] RDX: 00000000ffffffff RSI: 0000000000000001 RDI: ffff95d41a317600
      [    6.248591] RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000
      [    6.249810] R10: ffff95d417033c10 R11: 0000000000000000 R12: ffff95d4172c3a80
      [    6.251121] R13: ffff95d4172c3720 R14: ffff95d4172c3a98 R15: 00000000ffffffff
      [    6.252437] FS:  0000000000000000(0000) GS:ffff95d41fc00000(0000) knlGS:0000000000000000
      [    6.253887] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [    6.254814] CR2: 0000000000000228 CR3: 00000000172b4000 CR4: 00000000000006b0
      [    6.255943] Call Trace:
      [    6.256368]  remove_commit_idr_uobject+0x1b/0x80
      [    6.257118]  uverbs_cleanup_ucontext+0xe4/0x190
      [    6.257855]  ib_uverbs_cleanup_ucontext.constprop.14+0x19/0x40
      [    6.258857]  ib_uverbs_close+0x2a/0x100
      [    6.259494]  __fput+0xca/0x1c0
      [    6.259938]  task_work_run+0x84/0xa0
      [    6.260519]  do_exit+0x312/0xb40
      [    6.261023]  ? __do_page_fault+0x24d/0x490
      [    6.261707]  do_group_exit+0x3a/0xa0
      [    6.262267]  SyS_exit_group+0x10/0x10
      [    6.262802]  do_syscall_64+0x75/0x180
      [    6.263391]  entry_SYSCALL_64_after_hwframe+0x21/0x86
      [    6.264253] RIP: 0033:0x7f1b39c49488
      [    6.264827] RSP: 002b:00007ffe2de05b68 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
      [    6.266049] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f1b39c49488
      [    6.267187] RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
      [    6.268377] RBP: 00007f1b39f258e0 R08: 00000000000000e7 R09: ffffffffffffff98
      [    6.269640] R10: 00007f1b3a147260 R11: 0000000000000246 R12: 00007f1b39f258e0
      [    6.270783] R13: 00007f1b39f2ac20 R14: 0000000000000000 R15: 0000000000000000
      [    6.271943] Code: 74 07 31 d2 e9 25 d8 6c 00 b8 da ff ff ff c3 0f 1f
      44 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 8b 07 53 48 8b
      5f 08 <48> 8b 80 28 02 00 00 e8 f7 d7 6c 00 85 c0 75 04 3e ff 4b 18 5b
      [    6.274927] RIP: ib_dereg_mr+0xd/0x30 RSP: ffffaf5d001d7d68
      [    6.275760] CR2: 0000000000000228
      [    6.276200] ---[ end trace a35641f1c474bd20 ]---
      
      Fixes: e126ba97 ("mlx5: Add driver for Mellanox Connect-IB adapters")
      Cc: syzkaller <syzkaller@googlegroups.com>
      Cc: <stable@vger.kernel.org>
      Reported-by: default avatarNoa Osherovich <noaos@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8f59abbd
    • Chen-Yu Tsai's avatar
      clk: sunxi-ng: a31: Fix CLK_OUT_* clock ops · 9efd9903
      Chen-Yu Tsai authored
      commit 5682e268 upstream.
      
      When support for the A31/A31s CCU was first added, the clock ops for
      the CLK_OUT_* clocks was set to the wrong type. The clocks are MP-type,
      but the ops was set for div (M) clocks. This went unnoticed until now.
      This was because while they are different clocks, their data structures
      aligned in a way that ccu_div_ops would access the second ccu_div_internal
      and ccu_mux_internal structures, which were valid, if not incorrect.
      
      Furthermore, the use of these CLK_OUT_* was for feeding a precise 32.768
      kHz clock signal to the WiFi chip. This was achievable by using the parent
      with the same clock rate and no divider. So the incorrect divider setting
      did not affect this usage.
      
      Commit 946797aa ("clk: sunxi-ng: Support fixed post-dividers on MP
      style clocks") added a new field to the ccu_mp structure, which broke
      the aforementioned alignment. Now the system crashes as div_ops tries
      to look up a nonexistent table.
      Reported-by: default avatarPhilipp Rossak <embed3d@gmail.com>
      Tested-by: default avatarPhilipp Rossak <embed3d@gmail.com>
      Fixes: c6e6c96d ("clk: sunxi-ng: Add A31/A31s clocks")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9efd9903
    • Boris Brezillon's avatar
      clk: bcm2835: Protect sections updating shared registers · 55306d63
      Boris Brezillon authored
      commit 7997f3b2 upstream.
      
      CM_PLLx and A2W_XOSC_CTRL registers are accessed by different clock
      handlers and must be accessed with ->regs_lock held.
      Update the sections where this protection is missing.
      
      Fixes: 41691b88 ("clk: bcm2835: Add support for programming the audio domain clocks")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
      Reviewed-by: default avatarEric Anholt <eric@anholt.net>
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      55306d63
    • Boris Brezillon's avatar
      clk: bcm2835: Fix ana->maskX definitions · 2eb67f85
      Boris Brezillon authored
      commit 49012d1b upstream.
      
      ana->maskX values are already '~'-ed in bcm2835_pll_set_rate(). Remove
      the '~' in the definition to fix ANA setup.
      
      Note that this commit fixes a long standing bug preventing one from
      using an HDMI display if it's plugged after the FW has booted Linux.
      This is because PLLH is used by the HDMI encoder to generate the pixel
      clock.
      
      Fixes: 41691b88 ("clk: bcm2835: Add support for programming the audio domain clocks")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
      Reviewed-by: default avatarEric Anholt <eric@anholt.net>
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2eb67f85
    • Tetsuo Handa's avatar
      lockdep: fix fs_reclaim warning · ef006d43
      Tetsuo Handa authored
      commit 2e517d68 upstream.
      
      Dave Jones reported fs_reclaim lockdep warnings.
      
        ============================================
        WARNING: possible recursive locking detected
        4.15.0-rc9-backup-debug+ #1 Not tainted
        --------------------------------------------
        sshd/24800 is trying to acquire lock:
         (fs_reclaim){+.+.}, at: [<0000000084f438c2>] fs_reclaim_acquire.part.102+0x5/0x30
      
        but task is already holding lock:
         (fs_reclaim){+.+.}, at: [<0000000084f438c2>] fs_reclaim_acquire.part.102+0x5/0x30
      
        other info that might help us debug this:
         Possible unsafe locking scenario:
      
               CPU0
               ----
          lock(fs_reclaim);
          lock(fs_reclaim);
      
         *** DEADLOCK ***
      
         May be due to missing lock nesting notation
      
        2 locks held by sshd/24800:
         #0:  (sk_lock-AF_INET6){+.+.}, at: [<000000001a069652>] tcp_sendmsg+0x19/0x40
         #1:  (fs_reclaim){+.+.}, at: [<0000000084f438c2>] fs_reclaim_acquire.part.102+0x5/0x30
      
        stack backtrace:
        CPU: 3 PID: 24800 Comm: sshd Not tainted 4.15.0-rc9-backup-debug+ #1
        Call Trace:
         dump_stack+0xbc/0x13f
         __lock_acquire+0xa09/0x2040
         lock_acquire+0x12e/0x350
         fs_reclaim_acquire.part.102+0x29/0x30
         kmem_cache_alloc+0x3d/0x2c0
         alloc_extent_state+0xa7/0x410
         __clear_extent_bit+0x3ea/0x570
         try_release_extent_mapping+0x21a/0x260
         __btrfs_releasepage+0xb0/0x1c0
         btrfs_releasepage+0x161/0x170
         try_to_release_page+0x162/0x1c0
         shrink_page_list+0x1d5a/0x2fb0
         shrink_inactive_list+0x451/0x940
         shrink_node_memcg.constprop.88+0x4c9/0x5e0
         shrink_node+0x12d/0x260
         try_to_free_pages+0x418/0xaf0
         __alloc_pages_slowpath+0x976/0x1790
         __alloc_pages_nodemask+0x52c/0x5c0
         new_slab+0x374/0x3f0
         ___slab_alloc.constprop.81+0x47e/0x5a0
         __slab_alloc.constprop.80+0x32/0x60
         __kmalloc_track_caller+0x267/0x310
         __kmalloc_reserve.isra.40+0x29/0x80
         __alloc_skb+0xee/0x390
         sk_stream_alloc_skb+0xb8/0x340
         tcp_sendmsg_locked+0x8e6/0x1d30
         tcp_sendmsg+0x27/0x40
         inet_sendmsg+0xd0/0x310
         sock_write_iter+0x17a/0x240
         __vfs_write+0x2ab/0x380
         vfs_write+0xfb/0x260
         SyS_write+0xb6/0x140
         do_syscall_64+0x1e5/0xc05
         entry_SYSCALL64_slow_path+0x25/0x25
      
      This warning is caused by commit d92a8cfc ("locking/lockdep:
      Rework FS_RECLAIM annotation") which replaced the use of
      lockdep_{set,clear}_current_reclaim_state() in __perform_reclaim()
      and lockdep_trace_alloc() in slab_pre_alloc_hook() with
      fs_reclaim_acquire()/ fs_reclaim_release().
      
      Since __kmalloc_reserve() from __alloc_skb() adds __GFP_NOMEMALLOC |
      __GFP_NOWARN to gfp_mask, and all reclaim path simply propagates
      __GFP_NOMEMALLOC, fs_reclaim_acquire() in slab_pre_alloc_hook() is
      trying to grab the 'fake' lock again when __perform_reclaim() already
      grabbed the 'fake' lock.
      
      The
      
        /* this guy won't enter reclaim */
        if ((current->flags & PF_MEMALLOC) && !(gfp_mask & __GFP_NOMEMALLOC))
                return false;
      
      test which causes slab_pre_alloc_hook() to try to grab the 'fake' lock
      was added by commit cf40bd16 ("lockdep: annotate reclaim context
      (__GFP_NOFS)").  But that test is outdated because PF_MEMALLOC thread
      won't enter reclaim regardless of __GFP_NOMEMALLOC after commit
      341ce06f ("page allocator: calculate the alloc_flags for allocation
      only once") added the PF_MEMALLOC safeguard (
      
        /* Avoid recursion of direct reclaim */
        if (p->flags & PF_MEMALLOC)
                goto nopage;
      
      in __alloc_pages_slowpath()).
      
      Thus, let's fix outdated test by removing __GFP_NOMEMALLOC test and
      allow __need_fs_reclaim() to return false.
      
      Link: http://lkml.kernel.org/r/201802280650.FJC73911.FOSOMLJVFFQtHO@I-love.SAKURA.ne.jp
      Fixes: d92a8cfc ("locking/lockdep: Rework FS_RECLAIM annotation")
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Reported-by: default avatarDave Jones <davej@codemonkey.org.uk>
      Tested-by: default avatarDave Jones <davej@codemonkey.org.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Nick Piggin <npiggin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Nikolay Borisov <nborisov@suse.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: <stable@vger.kernel.org>	[4.14+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ef006d43
    • Hans de Goede's avatar
      ahci: Add PCI-id for the Highpoint Rocketraid 644L card · a05b6105
      Hans de Goede authored
      commit 28b2182d upstream.
      
      Like the Highpoint Rocketraid 642L and cards using a Marvel 88SE9235
      controller in general, this RAID card also supports AHCI mode and short
      of a custom driver, this is the only way to make it work under Linux.
      
      Note that even though the card is called to 644L, it has a product-id
      of 0x0645.
      
      Cc: stable@vger.kernel.org
      BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1534106Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a05b6105
    • Hans de Goede's avatar
      PCI: Add function 1 DMA alias quirk for Highpoint RocketRAID 644L · 8f5f582c
      Hans de Goede authored
      commit 1903be82 upstream.
      
      The Highpoint RocketRAID 644L uses a Marvel 88SE9235 controller, as with
      other Marvel controllers this needs a function 1 DMA alias quirk.
      
      Note the RocketRAID 642L uses the same Marvel 88SE9235 controller and
      already is listed with a function 1 DMA alias quirk.
      
      Cc: stable@vger.kernel.org
      BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1534106Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8f5f582c
    • Evgeniy Didin's avatar
      mmc: dw_mmc: fix falling from idmac to PIO mode when dw_mci_reset occurs · aa26895a
      Evgeniy Didin authored
      commit 47b7de2f upstream.
      
      It was found that in IDMAC mode after soft-reset driver switches
      to PIO mode.
      
      That's what happens in case of DTO timeout overflow calculation failure:
      1. soft-reset is called
      2. driver restarts dma
      3. descriptors states are checked, one of descriptor is owned by the IDMAC.
      4. driver can't use DMA and then switches to PIO mode.
      
      Failure was already fixed in:
      https://www.spinics.net/lists/linux-mmc/msg48125.html.
      
      Behaviour while soft-reset is not something we except or
      even want to happen. So we switch from dw_mci_idmac_reset
      to dw_mci_idmac_init, so descriptors are cleaned before starting dma.
      
      And while at it explicitly zero des0 which otherwise might
      contain garbage as being allocated by dmam_alloc_coherent().
      Signed-off-by: default avatarEvgeniy Didin <Evgeniy.Didin@synopsys.com>
      Cc: Jaehoon Chung <jh80.chung@samsung.com>
      Cc: Ulf Hansson <ulf.hansson@linaro.org>
      Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
      Cc: Shawn Lin <shawn.lin@rock-chips.com>
      Cc: Alexey Brodkin <abrodkin@synopsys.com>
      Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Cc: linux-snps-arc@lists.infradead.org
      Cc: <stable@vger.kernel.org> # 4.4+
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa26895a
    • Jaehoon Chung's avatar
      mmc: dw_mmc: exynos: fix the suspend/resume issue for exynos5433 · a592984e
      Jaehoon Chung authored
      commit e22842dd upstream.
      
      Before enabling the clock, dwmmc exynos driver is trying to access the
      register. Then the kernel panic can be occurred.
      Signed-off-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
      Reviewed-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
      Tested-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a592984e
    • Evgeniy Didin's avatar
      mmc: dw_mmc: Fix the DTO/CTO timeout overflow calculation for 32-bit systems · 23a8825a
      Evgeniy Didin authored
      commit c7151602 upstream.
      
      The commit 9d9491a7 ("mmc: dw_mmc: Fix the DTO timeout calculation")
      and commit 4c2357f5 ("mmc: dw_mmc: Fix the CTO timeout calculation")
      made changes, which cause multiply overflow for 32-bit systems. The broken
      timeout calculations leads to unexpected ETIMEDOUT errors and causes
      stacktrace splat (such as below) during normal data exchange with SD-card.
      
      | Running :  4M-check-reassembly-tcp-cmykw2-rotatew2.out -v0 -w1
      | -  Info: Finished target initialization.
      | mmcblk0: error -110 transferring data, sector 320544, nr 2048, cmd
      | response 0x900, card status 0x0
      
      DIV_ROUND_UP_ULL helps to escape usage of __udivdi3() from libgcc and so
      code gets compiled on all 32-bit platforms as opposed to usage of
      DIV_ROUND_UP when we may only compile stuff on a very few arches.
      
      Lets cast this multiply to u64 type to prevent the overflow.
      
      Fixes: 9d9491a7 ("mmc: dw_mmc: Fix the DTO timeout calculation")
      Fixes: 4c2357f5 ("mmc: dw_mmc: Fix the CTO timeout calculation")
      Tested-by: default avatarVineet Gupta <Vineet.Gupta1@synopsys.com>
      Reported-by: Vineet Gupta <Vineet.Gupta1@synopsys.com> # ARC STAR 9001306872 HSDK, sdio: board crashes when copying big files
      Signed-off-by: default avatarEvgeniy Didin <Evgeniy.Didin@synopsys.com>
      Cc: <stable@vger.kernel.org> # 4.14
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reviewed-by: default avatarShawn Lin <shawn.lin@rock-chips.com>
      Reviewed-by: default avatarJisheng Zhang <Jisheng.Zhang@synaptics.com>
      Acked-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      23a8825a
    • Bastian Stender's avatar
      mmc: block: fix updating ext_csd caches on ioctl call · 72439a30
      Bastian Stender authored
      commit e74ef219 upstream.
      
      PARTITION_CONFIG is cached in mmc_card->ext_csd.part_config and the
      currently active partition in mmc_blk_data->part_curr. These caches do
      not always reflect changes if the ioctl call modifies the
      PARTITION_CONFIG registers, e.g. by changing BOOT_PARTITION_ENABLE.
      
      Write the PARTITION_CONFIG value extracted from the ioctl call to the
      cache and update the currently active partition accordingly. This
      ensures that the user space cannot change the values behind the
      kernel's back. The next call to mmc_blk_part_switch() will operate on
      the data set by the ioctl and reflect the changes appropriately.
      Signed-off-by: default avatarBastian Stender <bst@pengutronix.de>
      Signed-off-by: default avatarJan Luebbe <jlu@pengutronix.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      72439a30
    • Dirk Behme's avatar
      mmc: core: Disable HPI for certain Micron (Numonyx) eMMC cards · 39254113
      Dirk Behme authored
      commit dbe7dc6b upstream.
      
      Certain Micron eMMC v4.5 cards might get broken when HPI feature is used
      and hence this patch disables the HPI feature for such buggy cards.
      
      In U-Boot, these cards are reported as
      
      Manufacturer: Micron (ID: 0xFE)
      OEM: 0x4E
      Name: MMC32G
      Revision: 19 (0x13)
      Serial: 959241022  Manufact. date: 8/2015 (0x82)  CRC: 0x00
      Tran Speed: 52000000
      Rd Block Len: 512
      MMC version 4.5
      High Capacity: Yes
      Capacity: 29.1 GiB
      Boot Partition Size: 16 MiB
      Bus Width: 8-bit
      
      According to JEDEC JEP106 manufacturer 0xFE is Numonyx, which was bought by
      Micron.
      Signed-off-by: default avatarDirk Behme <dirk.behme@de.bosch.com>
      Signed-off-by: default avatarMark Craske <Mark_Craske@mentor.com>
      Cc: <stable@vger.kernel.org> # 4.8+
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      39254113
    • Adrian Hunter's avatar
      mmc: core: Fix tracepoint print of blk_addr and blksz · fcc71c97
      Adrian Hunter authored
      commit c658dc58 upstream.
      
      Swap the positions of blk_addr and blksz in the tracepoint print arguments
      so that they match the print format.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Fixes: d2f82254 ("mmc: core: Add members to mmc_request and mmc_data for CQE's")
      Cc: <stable@vger.kernel.org> # 4.14+
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fcc71c97
    • Takashi Iwai's avatar
      ALSA: hda/realtek - Always immediately update mute LED with pin VREF · 856da5e0
      Takashi Iwai authored
      commit e40bdb03 upstream.
      
      Some HP laptops have a mute mute LED controlled by a pin VREF.  The
      Realtek codec driver updates the VREF via vmaster hook by calling
      snd_hda_set_pin_ctl_cache().
      
      This works fine as long as the driver is running in a normal mode.
      However, when the VREF change happens during the codec being in
      runtime PM suspend, the regmap access will skip and postpone the
      actual register change.  This ends up with the unchanged LED status
      until the next runtime PM resume even if you change the Master mute
      switch.  (Interestingly, the machine keeps the LED status even after
      the codec goes into D3 -- but it's another story.)
      
      For improving this usability, let the driver temporarily powering up /
      down only during the pin VREF change.  This can be achieved easily by
      wrapping the call with snd_hda_power_up_pm() / *_down_pm().
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199073
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      856da5e0
    • Kailang Yang's avatar
      ALSA: hda/realtek - Fix Dell headset Mic can't record · 7a42d11a
      Kailang Yang authored
      commit f0ba9d69 upstream.
      
      This platform was hardware fixed type for CTIA type for headset port.
      Assigned 0x19 verb will fix can't record issue.
      Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7a42d11a
    • Kailang Yang's avatar
      ALSA: hda/realtek - Fix speaker no sound after system resume · dc9d942e
      Kailang Yang authored
      commit 88d42b2b upstream.
      
      It will have a chance speaker no sound after system resume.
      To toggle NID 0x53 index 0x2 bit 15 will solve this issue.
      This usage will also suitable with ALC256.
      
      Fixes: 4a219ef8 ("ALSA: hda/realtek - Add ALC256 HP depop function")
      Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dc9d942e
    • Takashi Iwai's avatar
      ALSA: hda - Force polling mode on CFL for fixing codec communication · 8d49f562
      Takashi Iwai authored
      commit a8d7bde2 upstream.
      
      We've observed too long probe time with Coffee Lake (CFL) machines,
      and the likely cause is some communication problem between the
      HD-audio controller and the codec chips.  While the controller expects
      an IRQ wakeup for each codec response, it seems sometimes missing, and
      it takes one second for the controller driver to time out and read the
      response in the polling mode.
      
      Although we aren't sure about the real culprit yet, in this patch, we
      put a workaround by forcing the polling mode as default for CFL
      machines; the polling mode itself isn't too heavy, and much better
      than other workarounds initially suggested (e.g. disabling
      power-save), at least.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199007
      Fixes: e79b0006 ("ALSA: hda - Add Coffelake PCI ID")
      Reported-and-tested-by: default avatarHui Wang <hui.wang@canonical.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8d49f562
    • Takashi Iwai's avatar
      ALSA: aloop: Fix access to not-yet-ready substream via cable · 88079d33
      Takashi Iwai authored
      commit 8e6b1a72 upstream.
      
      In loopback_open() and loopback_close(), we assign and release the
      substream object to the corresponding cable in a racy way.  It's
      neither locked nor done in the right position.  The open callback
      assigns the substream before its preparation finishes, hence the other
      side of the cable may pick it up, which may lead to the invalid memory
      access.
      
      This patch addresses these: move the assignment to the end of the open
      callback, and wrap with cable->lock for avoiding concurrent accesses.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      88079d33
    • Takashi Iwai's avatar
      ALSA: aloop: Sync stale timer before release · 1fcbcfff
      Takashi Iwai authored
      commit 67a01afa upstream.
      
      The aloop driver tries to stop the pending timer via timer_del() in
      the trigger callback and in the close callback.  The former is
      correct, as it's an atomic operation, while the latter expects that
      the timer gets really removed and proceeds the resource releases after
      that.  But timer_del() doesn't synchronize, hence the running timer
      may still access the released resources.
      
      A similar situation can be also seen in the prepare callback after
      trigger(STOP) where the prepare tries to re-initialize the things
      while a timer is still running.
      
      The problems like the above are seen indirectly in some syzkaller
      reports (although it's not 100% clear whether this is the only cause,
      as the race condition is quite narrow and not always easy to
      trigger).
      
      For addressing these issues, this patch adds the explicit alls of
      timer_del_sync() in some places, so that the pending timer is properly
      killed / synced.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1fcbcfff
    • Kirill Marinushkin's avatar
      ALSA: usb-audio: Fix parsing descriptor of UAC2 processing unit · 3aa7360b
      Kirill Marinushkin authored
      commit a6618f4a upstream.
      
      Currently, the offsets in the UAC2 processing unit descriptor are
      calculated incorrectly. It causes an issue when connecting the device which
      provides such a feature:
      
      ~~~~
      [84126.724420] usb 1-1.3.1: invalid Processing Unit descriptor (id 18)
      ~~~~
      
      After this patch is applied, the UAC2 processing unit inits w/o this error.
      
      Fixes: 23caaf19 ("ALSA: usb-mixer: Add support for Audio Class v2.0")
      Signed-off-by: default avatarKirill Marinushkin <k.marinushkin@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3aa7360b
    • Dan Carpenter's avatar
      iio: adc: meson-saradc: unlock on error in meson_sar_adc_lock() · 2b706310
      Dan Carpenter authored
      commit 3c3e4b3a upstream.
      
      The meson_sar_adc_lock() function is not supposed to hold the
      "indio_dev->mlock" on the error path.
      
      Fixes: 3adbf342 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2b706310