1. 23 Jan, 2020 40 commits
    • Josef Bacik's avatar
      btrfs: rework arguments of btrfs_unlink_subvol · dab7dd71
      Josef Bacik authored
      [ Upstream commit 045d3967 ]
      
      btrfs_unlink_subvol takes the name of the dentry and the root objectid
      based on what kind of inode this is, either a real subvolume link or a
      empty one that we inherited as a snapshot.  We need to fix how we unlink
      in the case for BTRFS_EMPTY_SUBVOL_DIR_OBJECTID in the future, so rework
      btrfs_unlink_subvol to just take the dentry and handle getting the right
      objectid given the type of inode this is.  There is no functional change
      here, simply pushing the work into btrfs_unlink_subvol() proper.
      Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      dab7dd71
    • Adrian Huang's avatar
      mm: memcg/slab: call flush_memcg_workqueue() only if memcg workqueue is valid · bc603056
      Adrian Huang authored
      commit 2fe20210 upstream.
      
      When booting with amd_iommu=off, the following WARNING message
      appears:
      
        AMD-Vi: AMD IOMMU disabled on kernel command-line
        ------------[ cut here ]------------
        WARNING: CPU: 0 PID: 0 at kernel/workqueue.c:2772 flush_workqueue+0x42e/0x450
        Modules linked in:
        CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.5.0-rc3-amd-iommu #6
        Hardware name: Lenovo ThinkSystem SR655-2S/7D2WRCZ000, BIOS D8E101L-1.00 12/05/2019
        RIP: 0010:flush_workqueue+0x42e/0x450
        Code: ff 0f 0b e9 7a fd ff ff 4d 89 ef e9 33 fe ff ff 0f 0b e9 7f fd ff ff 0f 0b e9 bc fd ff ff 0f 0b e9 a8 fd ff ff e8 52 2c fe ff <0f> 0b 31 d2 48 c7 c6 e0 88 c5 95 48 c7 c7 d8 ad f0 95 e8 19 f5 04
        Call Trace:
         kmem_cache_destroy+0x69/0x260
         iommu_go_to_state+0x40c/0x5ab
         amd_iommu_prepare+0x16/0x2a
         irq_remapping_prepare+0x36/0x5f
         enable_IR_x2apic+0x21/0x172
         default_setup_apic_routing+0x12/0x6f
         apic_intr_mode_init+0x1a1/0x1f1
         x86_late_time_init+0x17/0x1c
         start_kernel+0x480/0x53f
         secondary_startup_64+0xb6/0xc0
        ---[ end trace 30894107c3749449 ]---
        x2apic: IRQ remapping doesn't support X2APIC mode
        x2apic disabled
      
      The warning is caused by the calling of 'kmem_cache_destroy()'
      in free_iommu_resources(). Here is the call path:
      
        free_iommu_resources
          kmem_cache_destroy
            flush_memcg_workqueue
              flush_workqueue
      
      The root cause is that the IOMMU subsystem runs before the workqueue
      subsystem, which the variable 'wq_online' is still 'false'.  This leads
      to the statement 'if (WARN_ON(!wq_online))' in flush_workqueue() is
      'true'.
      
      Since the variable 'memcg_kmem_cache_wq' is not allocated during the
      time, it is unnecessary to call flush_memcg_workqueue().  This prevents
      the WARNING message triggered by flush_workqueue().
      
      Link: http://lkml.kernel.org/r/20200103085503.1665-1-ahuang12@lenovo.com
      Fixes: 92ee383f ("mm: fix race between kmem_cache destroy, create and deactivate")
      Signed-off-by: default avatarAdrian Huang <ahuang12@lenovo.com>
      Reported-by: default avatarXiaochun Lee <lixc17@lenovo.com>
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Cc: Joerg Roedel <jroedel@suse.de>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Johannes Weiner <hannes@cmpxchg.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>
      bc603056
    • Kirill A. Shutemov's avatar
      mm/shmem.c: thp, shmem: fix conflict of above-47bit hint address and PMD alignment · a3071de2
      Kirill A. Shutemov authored
      commit 99158997 upstream.
      
      Shmem/tmpfs tries to provide THP-friendly mappings if huge pages are
      enabled.  But it doesn't work well with above-47bit hint address.
      
      Normally, the kernel doesn't create userspace mappings above 47-bit,
      even if the machine allows this (such as with 5-level paging on x86-64).
      Not all user space is ready to handle wide addresses.  It's known that
      at least some JIT compilers use higher bits in pointers to encode their
      information.
      
      Userspace can ask for allocation from full address space by specifying
      hint address (with or without MAP_FIXED) above 47-bits.  If the
      application doesn't need a particular address, but wants to allocate
      from whole address space it can specify -1 as a hint address.
      
      Unfortunately, this trick breaks THP alignment in shmem/tmp:
      shmem_get_unmapped_area() would not try to allocate PMD-aligned area if
      *any* hint address specified.
      
      This can be fixed by requesting the aligned area if the we failed to
      allocated at user-specified hint address.  The request with inflated
      length will also take the user-specified hint address.  This way we will
      not lose an allocation request from the full address space.
      
      [kirill@shutemov.name: fold in a fixup]
        Link: http://lkml.kernel.org/r/20191223231309.t6bh5hkbmokihpfu@box
      Link: http://lkml.kernel.org/r/20191220142548.7118-3-kirill.shutemov@linux.intel.com
      Fixes: b569bab7 ("x86/mm: Prepare to expose larger address space to userspace")
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: "Willhalm, Thomas" <thomas.willhalm@intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: "Bruggeman, Otto G" <otto.g.bruggeman@intel.com>
      Cc: "Aneesh Kumar K . V" <aneesh.kumar@linux.vnet.ibm.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>
      a3071de2
    • Jin Yao's avatar
      perf report: Fix incorrectly added dimensions as switch perf data file · 8caa8b36
      Jin Yao authored
      commit 0feba17b upstream.
      
      We observed an issue that was some extra columns displayed after switching
      perf data file in browser. The steps to reproduce:
      
      1. perf record -a -e cycles,instructions -- sleep 3
      2. perf report --group
      3. In browser, we use hotkey 's' to switch to another perf.data
      4. Now in browser, the extra columns 'Self' and 'Children' are displayed.
      
      The issue is setup_sorting() executed again after repeat path, so dimensions
      are added again.
      
      This patch checks the last key returned from __cmd_report(). If it's
      K_SWITCH_INPUT_DATA, skips the setup_sorting().
      
      Fixes: ad0de097 ("perf report: Enable the runtime switching of perf data file")
      Signed-off-by: default avatarJin Yao <yao.jin@linux.intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Feng Tang <feng.tang@intel.com>
      Cc: Jin Yao <yao.jin@intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20191220013722.20592-1-yao.jin@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8caa8b36
    • Yuya Fujita's avatar
      perf hists: Fix variable name's inconsistency in hists__for_each() macro · 7e4d65de
      Yuya Fujita authored
      commit 55347ec3 upstream.
      
      Variable names are inconsistent in hists__for_each macro().
      
      Due to this inconsistency, the macro replaces its second argument with
      "fmt" regardless of its original name.
      
      So far it works because only "fmt" is passed to the second argument.
      However, this behavior is not expected and should be fixed.
      
      Fixes: f0786af5 ("perf hists: Introduce hists__for_each_format macro")
      Fixes: aa6f50af ("perf hists: Introduce hists__for_each_sort_list macro")
      Signed-off-by: default avatarYuya Fujita <fujita.yuya@fujitsu.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/OSAPR01MB1588E1C47AC22043175DE1B2E8520@OSAPR01MB1588.jpnprd01.prod.outlook.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7e4d65de
    • Shakeel Butt's avatar
      x86/resctrl: Fix potential memory leak · bb8e8f42
      Shakeel Butt authored
      commit ab6a2114 upstream.
      
      set_cache_qos_cfg() is leaking memory when the given level is not
      RDT_RESOURCE_L3 or RDT_RESOURCE_L2. At the moment, this function is
      called with only valid levels but move the allocation after the valid
      level checks in order to make it more robust and future proof.
      
       [ bp: Massage commit message. ]
      
      Fixes: 99adde9b ("x86/intel_rdt: Enable L2 CDP in MSR IA32_L2_QOS_CFG")
      Signed-off-by: default avatarShakeel Butt <shakeelb@google.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Reinette Chatre <reinette.chatre@intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20200102165844.133133-1-shakeelb@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bb8e8f42
    • YueHaibing's avatar
      drm/i915: Add missing include file <linux/math64.h> · 107fb290
      YueHaibing authored
      commit ea38aa2e upstream.
      
      Fix build error:
      ./drivers/gpu/drm/i915/selftests/i915_random.h: In function i915_prandom_u32_max_state:
      ./drivers/gpu/drm/i915/selftests/i915_random.h:48:23: error:
       implicit declaration of function mul_u32_u32; did you mean mul_u64_u32_div? [-Werror=implicit-function-declaration]
        return upper_32_bits(mul_u32_u32(prandom_u32_state(state), ep_ro));
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Fixes: 7ce5b685 ("drm/i915/selftests: Use mul_u32_u32() for 32b x 32b -> 64b result")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200107135014.36472-1-yuehaibing@huawei.com
      (cherry picked from commit 62bf5465)
      Signed-off-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      107fb290
    • Ard Biesheuvel's avatar
      x86/efistub: Disable paging at mixed mode entry · 820ea0e5
      Ard Biesheuvel authored
      commit 4911ee40 upstream.
      
      The EFI mixed mode entry code goes through the ordinary startup_32()
      routine before jumping into the kernel's EFI boot code in 64-bit
      mode. The 32-bit startup code must be entered with paging disabled,
      but this is not documented as a requirement for the EFI handover
      protocol, and so we should disable paging explicitly when entering
      the kernel from 32-bit EFI firmware.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Cc: <stable@vger.kernel.org>
      Cc: Arvind Sankar <nivedita@alum.mit.edu>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: https://lkml.kernel.org/r/20191224132909.102540-4-ardb@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      820ea0e5
    • Tom Lendacky's avatar
      x86/CPU/AMD: Ensure clearing of SME/SEV features is maintained · 4d839755
      Tom Lendacky authored
      commit a006483b upstream.
      
      If the SME and SEV features are present via CPUID, but memory encryption
      support is not enabled (MSR 0xC001_0010[23]), the feature flags are cleared
      using clear_cpu_cap(). However, if get_cpu_cap() is later called, these
      feature flags will be reset back to present, which is not desired.
      
      Change from using clear_cpu_cap() to setup_clear_cpu_cap() so that the
      clearing of the flags is maintained.
      Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: <stable@vger.kernel.org> # 4.16.x-
      Link: https://lkml.kernel.org/r/226de90a703c3c0be5a49565047905ac4e94e8f3.1579125915.git.thomas.lendacky@amd.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4d839755
    • Qian Cai's avatar
      x86/resctrl: Fix an imbalance in domain_remove_cpu() · 7e22f494
      Qian Cai authored
      commit e278af89 upstream.
      
      A system that supports resource monitoring may have multiple resources
      while not all of these resources are capable of monitoring. Monitoring
      related state is initialized only for resources that are capable of
      monitoring and correspondingly this state should subsequently only be
      removed from these resources that are capable of monitoring.
      
      domain_add_cpu() calls domain_setup_mon_state() only when r->mon_capable
      is true where it will initialize d->mbm_over. However,
      domain_remove_cpu() calls cancel_delayed_work(&d->mbm_over) without
      checking r->mon_capable resulting in an attempt to cancel d->mbm_over on
      all resources, even those that never initialized d->mbm_over because
      they are not capable of monitoring. Hence, it triggers a debugobjects
      warning when offlining CPUs because those timer debugobjects are never
      initialized:
      
        ODEBUG: assert_init not available (active state 0) object type:
        timer_list hint: 0x0
        WARNING: CPU: 143 PID: 789 at lib/debugobjects.c:484
        debug_print_object
        Hardware name: HP Synergy 680 Gen9/Synergy 680 Gen9 Compute Module, BIOS I40 05/23/2018
        RIP: 0010:debug_print_object
        Call Trace:
        debug_object_assert_init
        del_timer
        try_to_grab_pending
        cancel_delayed_work
        resctrl_offline_cpu
        cpuhp_invoke_callback
        cpuhp_thread_fun
        smpboot_thread_fn
        kthread
        ret_from_fork
      
      Fixes: e3302683 ("x86/intel_rdt/mbm: Handle counter overflow")
      Signed-off-by: default avatarQian Cai <cai@lca.pw>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Acked-by: default avatarReinette Chatre <reinette.chatre@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: john.stultz@linaro.org
      Cc: sboyd@kernel.org
      Cc: <stable@vger.kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: tj@kernel.org
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vikas Shivappa <vikas.shivappa@linux.intel.com>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191211033042.2188-1-cai@lca.pwSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7e22f494
    • Keiya Nobuta's avatar
      usb: core: hub: Improved device recognition on remote wakeup · ecd8db99
      Keiya Nobuta authored
      commit 9c06ac4c upstream.
      
      If hub_activate() is called before D+ has stabilized after remote
      wakeup, the following situation might occur:
      
               __      ___________________
              /  \    /
      D+   __/    \__/
      
      Hub  _______________________________
                |  ^   ^           ^
                |  |   |           |
      Host _____v__|___|___________|______
                |  |   |           |
                |  |   |           \-- Interrupt Transfer (*3)
                |  |    \-- ClearPortFeature (*2)
                |   \-- GetPortStatus (*1)
                \-- Host detects remote wakeup
      
      - D+ goes high, Host starts running by remote wakeup
      - D+ is not stable, goes low
      - Host requests GetPortStatus at (*1) and gets the following hub status:
        - Current Connect Status bit is 0
        - Connect Status Change bit is 1
      - D+ stabilizes, goes high
      - Host requests ClearPortFeature and thus Connect Status Change bit is
        cleared at (*2)
      - After waiting 100 ms, Host starts the Interrupt Transfer at (*3)
      - Since the Connect Status Change bit is 0, Hub returns NAK.
      
      In this case, port_event() is not called in hub_event() and Host cannot
      recognize device. To solve this issue, flag change_bits even if only
      Connect Status Change bit is 1 when got in the first GetPortStatus.
      
      This issue occurs rarely because it only if D+ changes during a very
      short time between GetPortStatus and ClearPortFeature. However, it is
      fatal if it occurs in embedded system.
      Signed-off-by: default avatarKeiya Nobuta <nobuta.keiya@fujitsu.com>
      Cc: stable <stable@vger.kernel.org>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/20200109051448.28150-1-nobuta.keiya@fujitsu.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ecd8db99
    • Christian Brauner's avatar
      ptrace: reintroduce usage of subjective credentials in ptrace_has_cap() · 21cd79a2
      Christian Brauner authored
      commit 6b3ad664 upstream.
      
      Commit 69f594a3 ("ptrace: do not audit capability check when outputing /proc/pid/stat")
      introduced the ability to opt out of audit messages for accesses to various
      proc files since they are not violations of policy.  While doing so it
      somehow switched the check from ns_capable() to
      has_ns_capability{_noaudit}(). That means it switched from checking the
      subjective credentials of the task to using the objective credentials. This
      is wrong since. ptrace_has_cap() is currently only used in
      ptrace_may_access() And is used to check whether the calling task (subject)
      has the CAP_SYS_PTRACE capability in the provided user namespace to operate
      on the target task (object). According to the cred.h comments this would
      mean the subjective credentials of the calling task need to be used.
      This switches ptrace_has_cap() to use security_capable(). Because we only
      call ptrace_has_cap() in ptrace_may_access() and in there we already have a
      stable reference to the calling task's creds under rcu_read_lock() there's
      no need to go through another series of dereferences and rcu locking done
      in ns_capable{_noaudit}().
      
      As one example where this might be particularly problematic, Jann pointed
      out that in combination with the upcoming IORING_OP_OPENAT feature, this
      bug might allow unprivileged users to bypass the capability checks while
      asynchronously opening files like /proc/*/mem, because the capability
      checks for this would be performed against kernel credentials.
      
      To illustrate on the former point about this being exploitable: When
      io_uring creates a new context it records the subjective credentials of the
      caller. Later on, when it starts to do work it creates a kernel thread and
      registers a callback. The callback runs with kernel creds for
      ktask->real_cred and ktask->cred. To prevent this from becoming a
      full-blown 0-day io_uring will call override_cred() and override
      ktask->cred with the subjective credentials of the creator of the io_uring
      instance. With ptrace_has_cap() currently looking at ktask->real_cred this
      override will be ineffective and the caller will be able to open arbitray
      proc files as mentioned above.
      Luckily, this is currently not exploitable but will turn into a 0-day once
      IORING_OP_OPENAT{2} land in v5.6. Fix it now!
      
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarSerge Hallyn <serge@hallyn.com>
      Reviewed-by: default avatarJann Horn <jannh@google.com>
      Fixes: 69f594a3 ("ptrace: do not audit capability check when outputing /proc/pid/stat")
      Signed-off-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      21cd79a2
    • Micah Morton's avatar
      LSM: generalize flag passing to security_capable · 87ca9aaf
      Micah Morton authored
      [ Upstream commit c1a85a00 ]
      
      This patch provides a general mechanism for passing flags to the
      security_capable LSM hook. It replaces the specific 'audit' flag that is
      used to tell security_capable whether it should log an audit message for
      the given capability check. The reason for generalizing this flag
      passing is so we can add an additional flag that signifies whether
      security_capable is being called by a setid syscall (which is needed by
      the proposed SafeSetID LSM).
      Signed-off-by: default avatarMicah Morton <mortonm@chromium.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarJames Morris <james.morris@microsoft.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      87ca9aaf
    • Kishon Vijay Abraham I's avatar
      ARM: dts: am571x-idk: Fix gpios property to have the correct gpio number · 991d8c73
      Kishon Vijay Abraham I authored
      commit 0c4eb2a6 upstream.
      
      commit d23f3839 ("ARM: dts: DRA7: Add pcie1 dt node for
      EP mode") while adding the dt node for EP mode for DRA7 platform,
      added rc node for am571x-idk and populated gpios property with
      "gpio3 23". However the GPIO_PCIE_SWRST line is actually connected
      to "gpio5 18". Fix it here. (The patch adding "gpio3 23" was tested
      with another am57x board in EP mode which doesn't rely on reset from
      host).
      
      Cc: stable <stable@vger.kernel.org> # 4.14+
      Fixes: d23f3839 ("ARM: dts: DRA7: Add pcie1 dt node for EP mode")
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      991d8c73
    • Mikulas Patocka's avatar
      block: fix an integer overflow in logical block size · a7f79052
      Mikulas Patocka authored
      commit ad6bf88a upstream.
      
      Logical block size has type unsigned short. That means that it can be at
      most 32768. However, there are architectures that can run with 64k pages
      (for example arm64) and on these architectures, it may be possible to
      create block devices with 64k block size.
      
      For exmaple (run this on an architecture with 64k pages):
      
      Mount will fail with this error because it tries to read the superblock using 2-sector
      access:
        device-mapper: writecache: I/O is not aligned, sector 2, size 1024, block size 65536
        EXT4-fs (dm-0): unable to read superblock
      
      This patch changes the logical block size from unsigned short to unsigned
      int to avoid the overflow.
      
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a7f79052
    • Jari Ruusu's avatar
      Fix built-in early-load Intel microcode alignment · 8d9fd1f4
      Jari Ruusu authored
      commit f5ae2ea6 upstream.
      
      Intel Software Developer's Manual, volume 3, chapter 9.11.6 says:
      
       "Note that the microcode update must be aligned on a 16-byte boundary
        and the size of the microcode update must be 1-KByte granular"
      
      When early-load Intel microcode is loaded from initramfs, userspace tool
      'iucode_tool' has already 16-byte aligned those microcode bits in that
      initramfs image.  Image that was created something like this:
      
       iucode_tool --write-earlyfw=FOO.cpio microcode-files...
      
      However, when early-load Intel microcode is loaded from built-in
      firmware BLOB using CONFIG_EXTRA_FIRMWARE= kernel config option, that
      16-byte alignment is not guaranteed.
      
      Fix this by forcing all built-in firmware BLOBs to 16-byte alignment.
      
      [ If we end up having other firmware with much bigger alignment
        requirements, we might need to introduce some method for the firmware
        to specify it, this is the minimal "just increase the alignment a bit
        to account for this one special case" patch    - Linus ]
      Signed-off-by: default avatarJari Ruusu <jari.ruusu@gmail.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Luis Chamberlain <mcgrof@kernel.org>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8d9fd1f4
    • Stefan Mavrodiev's avatar
      arm64: dts: allwinner: a64: olinuxino: Fix SDIO supply regulator · c7d4d1ad
      Stefan Mavrodiev authored
      commit 3d615c2f upstream.
      
      A64-OLinuXino uses DCDC1 (VCC-IO) for MMC1 supply. In commit 916b68cf
      ("arm64: dts: a64-olinuxino: Enable RTL8723BS WiFi") ALDO2 is set, which is
      VCC-PL. Since DCDC1 is always present, the boards are working without a
      problem.
      
      This patch sets the correct regulator.
      
      Fixes: 916b68cf ("arm64: dts: a64-olinuxino: Enable RTL8723BS WiFi")
      Cc: stable@vger.kernel.org # v4.16+
      Signed-off-by: default avatarStefan Mavrodiev <stefan@olimex.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c7d4d1ad
    • Johan Hovold's avatar
      ALSA: usb-audio: fix sync-ep altsetting sanity check · aa7e8db2
      Johan Hovold authored
      commit 5d1b7122 upstream.
      
      The altsetting sanity check in set_sync_ep_implicit_fb_quirk() was
      checking for there to be at least one altsetting but then went on to
      access the second one, which may not exist.
      
      This could lead to random slab data being used to initialise the sync
      endpoint in snd_usb_add_endpoint().
      
      Fixes: c75a8a7a ("ALSA: snd-usb: add support for implicit feedback")
      Fixes: ca10a7eb ("ALSA: usb-audio: FT C400 sync playback EP to capture EP")
      Fixes: 5e35dc03 ("ALSA: usb-audio: add implicit fb quirk for Behringer UFX1204")
      Fixes: 17f08b0d ("ALSA: usb-audio: add implicit fb quirk for Axe-Fx II")
      Fixes: 103e9625 ("ALSA: usb-audio: simplify set_sync_ep_implicit_fb_quirk")
      Cc: stable <stable@vger.kernel.org>     # 3.5
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Link: https://lore.kernel.org/r/20200114083953.1106-1-johan@kernel.orgSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa7e8db2
    • Takashi Iwai's avatar
      ALSA: seq: Fix racy access for queue timer in proc read · 20f2e4c2
      Takashi Iwai authored
      commit 60adcfde upstream.
      
      snd_seq_info_timer_read() reads the information of the timer assigned
      for each queue, but it's done in a racy way which may lead to UAF as
      spotted by syzkaller.
      
      This patch applies the missing q->timer_mutex lock while accessing the
      timer object as well as a slight code change to adapt the standard
      coding style.
      
      Reported-by: syzbot+2b2ef983f973e5c40943@syzkaller.appspotmail.com
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200115203733.26530-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      20f2e4c2
    • Takashi Sakamoto's avatar
      ALSA: dice: fix fallback from protocol extension into limited functionality · e68bc5ef
      Takashi Sakamoto authored
      commit 3e2dc6bd upstream.
      
      At failure of attempt to detect protocol extension, ALSA dice driver
      should be fallback to limited functionality. However it's not.
      
      This commit fixes it.
      
      Cc: <stable@vger.kernel.org> # v4.18+
      Fixes: 58579c05 ("ALSA: dice: use extended protocol to detect available stream formats")
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Link: https://lore.kernel.org/r/20200113084630.14305-2-o-takashi@sakamocchi.jpSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e68bc5ef
    • Marek Vasut's avatar
      ARM: dts: imx6q-dhcom: Fix SGTL5000 VDDIO regulator connection · 6a75df0c
      Marek Vasut authored
      commit fe6a6689 upstream.
      
      The SGTL5000 VDDIO is connected to the PMIC SW2 output, not to
      a fixed 3V3 rail. Describe this correctly in the DT.
      
      Fixes: 52c7a088 ("ARM: dts: imx6q: Add support for the DHCOM iMX6 SoM and PDK2")
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Ludwig Zenz <lzenz@dh-electronics.com>
      Cc: NXP Linux Team <linux-imx@nxp.com>
      To: linux-arm-kernel@lists.infradead.org
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6a75df0c
    • Stephan Gerhold's avatar
      ASoC: msm8916-wcd-analog: Fix MIC BIAS Internal1 · 095fa892
      Stephan Gerhold authored
      commit 057efcf9 upstream.
      
      MIC BIAS Internal1 is broken at the moment because we always
      enable the internal rbias resistor to the TX2 line (connected to
      the headset microphone), rather than enabling the resistor connected
      to TX1.
      
      Move the RBIAS code to pm8916_wcd_analog_enable_micbias_int1/2()
      to fix this.
      
      Fixes: 585e881e ("ASoC: codecs: Add msm8916-wcd analog codec")
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
      Link: https://lore.kernel.org/r/20200111164006.43074-3-stephan@gerhold.netSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      095fa892
    • Stephan Gerhold's avatar
      ASoC: msm8916-wcd-analog: Fix selected events for MIC BIAS External1 · 0e3df2d7
      Stephan Gerhold authored
      commit e0beec88 upstream.
      
      MIC BIAS External1 sets pm8916_wcd_analog_enable_micbias_ext1()
      as event handler, which ends up in pm8916_wcd_analog_enable_micbias_ext().
      
      But pm8916_wcd_analog_enable_micbias_ext() only handles the POST_PMU
      event, which is not specified in the event flags for MIC BIAS External1.
      This means that the code in the event handler is never actually run.
      
      Set SND_SOC_DAPM_POST_PMU as the only event for the handler to fix this.
      
      Fixes: 585e881e ("ASoC: codecs: Add msm8916-wcd analog codec")
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
      Link: https://lore.kernel.org/r/20200111164006.43074-2-stephan@gerhold.netSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0e3df2d7
    • Dan Carpenter's avatar
      scsi: mptfusion: Fix double fetch bug in ioctl · 3dae5041
      Dan Carpenter authored
      commit 28d76df1 upstream.
      
      Tom Hatskevich reported that we look up "iocp" then, in the called
      functions we do a second copy_from_user() and look it up again.
      The problem that could cause is:
      
      drivers/message/fusion/mptctl.c
         674          /* All of these commands require an interrupt or
         675           * are unknown/illegal.
         676           */
         677          if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0)
                                                     ^^^^
      We take this lock.
      
         678                  return ret;
         679
         680          if (cmd == MPTFWDOWNLOAD)
         681                  ret = mptctl_fw_download(arg);
                                                       ^^^
      Then the user memory changes and we look up "iocp" again but a different
      one so now we are holding the incorrect lock and have a race condition.
      
         682          else if (cmd == MPTCOMMAND)
         683                  ret = mptctl_mpt_command(arg);
      
      The security impact of this bug is not as bad as it could have been
      because these operations are all privileged and root already has
      enormous destructive power.  But it's still worth fixing.
      
      This patch passes the "iocp" pointer to the functions to avoid the
      second lookup.  That deletes 100 lines of code from the driver so
      it's a nice clean up as well.
      
      Link: https://lore.kernel.org/r/20200114123414.GA7957@kadamReported-by: default avatarTom Hatskevich <tom2001tom.23@gmail.com>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3dae5041
    • Arnd Bergmann's avatar
      scsi: fnic: fix invalid stack access · ac13a00a
      Arnd Bergmann authored
      commit 42ec15ce upstream.
      
      gcc -O3 warns that some local variables are not properly initialized:
      
      drivers/scsi/fnic/vnic_dev.c: In function 'fnic_dev_hang_notify':
      drivers/scsi/fnic/vnic_dev.c:511:16: error: 'a0' is used uninitialized in this function [-Werror=uninitialized]
        vdev->args[0] = *a0;
        ~~~~~~~~~~~~~~^~~~~
      drivers/scsi/fnic/vnic_dev.c:691:6: note: 'a0' was declared here
        u64 a0, a1;
            ^~
      drivers/scsi/fnic/vnic_dev.c:512:16: error: 'a1' is used uninitialized in this function [-Werror=uninitialized]
        vdev->args[1] = *a1;
        ~~~~~~~~~~~~~~^~~~~
      drivers/scsi/fnic/vnic_dev.c:691:10: note: 'a1' was declared here
        u64 a0, a1;
                ^~
      drivers/scsi/fnic/vnic_dev.c: In function 'fnic_dev_mac_addr':
      drivers/scsi/fnic/vnic_dev.c:512:16: error: 'a1' is used uninitialized in this function [-Werror=uninitialized]
        vdev->args[1] = *a1;
        ~~~~~~~~~~~~~~^~~~~
      drivers/scsi/fnic/vnic_dev.c:698:10: note: 'a1' was declared here
        u64 a0, a1;
                ^~
      
      Apparently the code relies on the local variables occupying adjacent memory
      locations in the same order, but this is of course not guaranteed.
      
      Use an array of two u64 variables where needed to make it work correctly.
      
      I suspect there is also an endianness bug here, but have not digged in deep
      enough to be sure.
      
      Fixes: 5df6d737 ("[SCSI] fnic: Add new Cisco PCI-Express FCoE HBA")
      Fixes: mmtom ("init/Kconfig: enable -O3 for all arches")
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20200107201602.4096790-1-arnd@arndb.deSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac13a00a
    • Johan Hovold's avatar
      USB: serial: quatech2: handle unbound ports · 392950d7
      Johan Hovold authored
      commit 9715a43e upstream.
      
      Check for NULL port data in the modem- and line-status handlers to avoid
      dereferencing a NULL pointer in the unlikely case where a port device
      isn't bound to a driver (e.g. after an allocation failure on port
      probe).
      
      Note that the other (stubbed) event handlers qt2_process_xmit_empty()
      and qt2_process_flush() would need similar sanity checks in case they
      are ever implemented.
      
      Fixes: f7a33e60 ("USB: serial: add quatech2 usb to serial driver")
      Cc: stable <stable@vger.kernel.org>     # 3.5
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      392950d7
    • Johan Hovold's avatar
      USB: serial: keyspan: handle unbound ports · 655e0b39
      Johan Hovold authored
      commit 3018dd3f upstream.
      
      Check for NULL port data in the control URB completion handlers to avoid
      dereferencing a NULL pointer in the unlikely case where a port device
      isn't bound to a driver (e.g. after an allocation failure on port
      probe()).
      
      Fixes: 0ca1268e ("USB Serial Keyspan: add support for USA-49WG & USA-28XG")
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      655e0b39
    • Johan Hovold's avatar
      USB: serial: io_edgeport: add missing active-port sanity check · d5f7cbcd
      Johan Hovold authored
      commit 1568c58d upstream.
      
      The driver receives the active port number from the device, but never
      made sure that the port number was valid. This could lead to a
      NULL-pointer dereference or memory corruption in case a device sends
      data for an invalid port.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d5f7cbcd
    • Johan Hovold's avatar
      USB: serial: io_edgeport: handle unbound ports on URB completion · 8dbc5ed3
      Johan Hovold authored
      commit e37d1aed upstream.
      
      Check for NULL port data in the shared interrupt and bulk completion
      callbacks to avoid dereferencing a NULL pointer in case a device sends
      data for a port device which isn't bound to a driver (e.g. due to a
      malicious device having unexpected endpoints or after an allocation
      failure on port probe).
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8dbc5ed3
    • Johan Hovold's avatar
      USB: serial: ch341: handle unbound port at reset_resume · 9b057d12
      Johan Hovold authored
      commit 4d5ef53f upstream.
      
      Check for NULL port data in reset_resume() to avoid dereferencing a NULL
      pointer in case the port device isn't bound to a driver (e.g. after a
      failed control request at port probe).
      
      Fixes: 1ded7ea4 ("USB: ch341 serial: fix port number changed after resume")
      Cc: stable <stable@vger.kernel.org>     # 2.6.30
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9b057d12
    • Johan Hovold's avatar
      USB: serial: suppress driver bind attributes · 1b86caef
      Johan Hovold authored
      commit fdb838ef upstream.
      
      USB-serial drivers must not be unbound from their ports before the
      corresponding USB driver is unbound from the parent interface so
      suppress the bind and unbind attributes.
      
      Unbinding a serial driver while it's port is open is a sure way to
      trigger a crash as any driver state is released on unbind while port
      hangup is handled on the parent USB interface level. Drivers for
      multiport devices where ports share a resource such as an interrupt
      endpoint also generally cannot handle individual ports going away.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1b86caef
    • Reinhard Speyerer's avatar
      USB: serial: option: add support for Quectel RM500Q in QDL mode · 845c8f49
      Reinhard Speyerer authored
      commit f3eaabbf upstream.
      
      Add support for Quectel RM500Q in QDL mode.
      
      T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 24 Spd=480  MxCh= 0
      D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0800 Rev= 0.00
      S:  Manufacturer=Qualcomm CDMA Technologies MSM
      S:  Product=QUSB_BULK_SN:xxxxxxxx
      S:  SerialNumber=xxxxxxxx
      C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=  2mA
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=10 Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      It is assumed that the ZLP flag required for other Qualcomm-based
      5G devices also applies to Quectel RM500Q.
      Signed-off-by: default avatarReinhard Speyerer <rspmn@arcor.de>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      845c8f49
    • Johan Hovold's avatar
      USB: serial: opticon: fix control-message timeouts · cfb62fbc
      Johan Hovold authored
      commit 5e28055f upstream.
      
      The driver was issuing synchronous uninterruptible control requests
      without using a timeout. This could lead to the driver hanging
      on open() or tiocmset() due to a malfunctioning (or malicious) device
      until the device is physically disconnected.
      
      The USB upper limit of five seconds per request should be more than
      enough.
      
      Fixes: 309a0579 ("USB: opticon: add rts and cts support")
      Cc: stable <stable@vger.kernel.org>     # 2.6.39
      Cc: Martin Jansen <martin.jansen@opticon.com>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cfb62fbc
    • Kristian Evensen's avatar
      USB: serial: option: Add support for Quectel RM500Q · 805083d1
      Kristian Evensen authored
      commit accf227d upstream.
      
      RM500Q is a 5G module from Quectel, supporting both standalone and
      non-standalone modes. Unlike other recent Quectel modems, it is possible
      to identify the diagnostic interface (bInterfaceProtocol is unique).
      Thus, there is no need to check for the number of endpoints or reserve
      interfaces. The interface number is still dynamic though, so matching on
      interface number is not possible and two entries have to be added to the
      table.
      
      Output from usb-devices with all interfaces enabled (order is diag,
      nmea, at_port, modem, rmnet and adb):
      
      Bus 004 Device 007: ID 2c7c:0800 Quectel Wireless Solutions Co., Ltd.
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               3.20
        bDeviceClass            0 (Defined at Interface level)
        bDeviceSubClass         0
        bDeviceProtocol         0
        bMaxPacketSize0         9
        idVendor           0x2c7c Quectel Wireless Solutions Co., Ltd.
        idProduct          0x0800
        bcdDevice            4.14
        iManufacturer           1 Quectel
        iProduct                2 LTE-A Module
        iSerial                 3 40046d60
        bNumConfigurations      1
        Configuration Descriptor:
          bLength                 9
          bDescriptorType         2
          wTotalLength          328
          bNumInterfaces          6
          bConfigurationValue     1
          iConfiguration          4 DIAG_SER_RMNET
          bmAttributes         0xa0
            (Bus Powered)
            Remote Wakeup
          MaxPower              224mA
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass       255 Vendor Specific Class
            bInterfaceSubClass    255 Vendor Specific Subclass
            bInterfaceProtocol     48
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x81  EP 1 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0400  1x 1024 bytes
              bInterval               0
              bMaxBurst               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x01  EP 1 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0400  1x 1024 bytes
              bInterval               0
              bMaxBurst               0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        1
            bAlternateSetting       0
            bNumEndpoints           3
            bInterfaceClass       255 Vendor Specific Class
            bInterfaceSubClass      0
            bInterfaceProtocol      0
            iInterface              0
            ** UNRECOGNIZED:  05 24 00 10 01
            ** UNRECOGNIZED:  05 24 01 00 00
            ** UNRECOGNIZED:  04 24 02 02
            ** UNRECOGNIZED:  05 24 06 00 00
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x83  EP 3 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x000a  1x 10 bytes
              bInterval               9
              bMaxBurst               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x82  EP 2 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0400  1x 1024 bytes
              bInterval               0
              bMaxBurst               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x02  EP 2 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0400  1x 1024 bytes
              bInterval               0
              bMaxBurst               0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        2
            bAlternateSetting       0
            bNumEndpoints           3
            bInterfaceClass       255 Vendor Specific Class
            bInterfaceSubClass      0
            bInterfaceProtocol      0
            iInterface              0
            ** UNRECOGNIZED:  05 24 00 10 01
            ** UNRECOGNIZED:  05 24 01 00 00
            ** UNRECOGNIZED:  04 24 02 02
            ** UNRECOGNIZED:  05 24 06 00 00
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x85  EP 5 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x000a  1x 10 bytes
              bInterval               9
              bMaxBurst               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x84  EP 4 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0400  1x 1024 bytes
              bInterval               0
              bMaxBurst               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x03  EP 3 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0400  1x 1024 bytes
              bInterval               0
              bMaxBurst               0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        3
            bAlternateSetting       0
            bNumEndpoints           3
            bInterfaceClass       255 Vendor Specific Class
            bInterfaceSubClass      0
            bInterfaceProtocol      0
            iInterface              0
            ** UNRECOGNIZED:  05 24 00 10 01
            ** UNRECOGNIZED:  05 24 01 00 00
            ** UNRECOGNIZED:  04 24 02 02
            ** UNRECOGNIZED:  05 24 06 00 00
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x87  EP 7 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x000a  1x 10 bytes
              bInterval               9
              bMaxBurst               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x86  EP 6 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0400  1x 1024 bytes
              bInterval               0
              bMaxBurst               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x04  EP 4 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0400  1x 1024 bytes
              bInterval               0
              bMaxBurst               0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        4
            bAlternateSetting       0
            bNumEndpoints           3
            bInterfaceClass       255 Vendor Specific Class
            bInterfaceSubClass    255 Vendor Specific Subclass
            bInterfaceProtocol    255 Vendor Specific Protocol
            iInterface              5 CDEV Serial
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x88  EP 8 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0008  1x 8 bytes
              bInterval               9
              bMaxBurst               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x8e  EP 14 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0400  1x 1024 bytes
              bInterval               0
              bMaxBurst               6
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x0f  EP 15 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0400  1x 1024 bytes
              bInterval               0
              bMaxBurst               2
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        5
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass       255 Vendor Specific Class
            bInterfaceSubClass     66
            bInterfaceProtocol      1
            iInterface              6 ADB Interface
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x05  EP 5 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0400  1x 1024 bytes
              bInterval               0
              bMaxBurst               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x89  EP 9 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0400  1x 1024 bytes
              bInterval               0
              bMaxBurst               0
      Binary Object Store Descriptor:
        bLength                 5
        bDescriptorType        15
        wTotalLength           42
        bNumDeviceCaps          3
        USB 2.0 Extension Device Capability:
          bLength                 7
          bDescriptorType        16
          bDevCapabilityType      2
          bmAttributes   0x00000006
            Link Power Management (LPM) Supported
        SuperSpeed USB Device Capability:
          bLength                10
          bDescriptorType        16
          bDevCapabilityType      3
          bmAttributes         0x00
          wSpeedsSupported   0x000f
            Device can operate at Low Speed (1Mbps)
            Device can operate at Full Speed (12Mbps)
            Device can operate at High Speed (480Mbps)
            Device can operate at SuperSpeed (5Gbps)
          bFunctionalitySupport   1
            Lowest fully-functional device speed is Full Speed (12Mbps)
          bU1DevExitLat           1 micro seconds
          bU2DevExitLat         500 micro seconds
        ** UNRECOGNIZED:  14 10 0a 00 01 00 00 00 00 11 00 00 30 40 0a 00 b0 40 0a 00
      Device Status:     0x0000
        (Bus Powered)
      Signed-off-by: default avatarKristian Evensen <kristian.evensen@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      805083d1
    • Jerónimo Borque's avatar
      USB: serial: simple: Add Motorola Solutions TETRA MTP3xxx and MTP85xx · 69874bf1
      Jerónimo Borque authored
      commit 260e41ac upstream.
      
      Add device-ids for the Motorola Solutions TETRA radios MTP3xxx series
      and MTP85xx series
      
      $ lsusb -vd 0cad:
      
      Bus 001 Device 009: ID 0cad:9015 Motorola CGISS TETRA PEI interface
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass            0
        bDeviceSubClass         0
        bDeviceProtocol         0
        bMaxPacketSize0        64
        idVendor           0x0cad Motorola CGISS
        idProduct          0x9015
        bcdDevice           24.16
        iManufacturer           1
        iProduct                2
        iSerial                 0
        bNumConfigurations      1
        Configuration Descriptor:
          bLength                 9
          bDescriptorType         2
          wTotalLength       0x0037
          bNumInterfaces          2
          bConfigurationValue     1
          iConfiguration          3
          bmAttributes         0x80
            (Bus Powered)
          MaxPower              500mA
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass       255 Vendor Specific Class
            bInterfaceSubClass      0
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x81  EP 1 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x01  EP 1 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        1
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass       255 Vendor Specific Class
            bInterfaceSubClass      0
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x82  EP 2 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x02  EP 2 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               0
      
      Bus 001 Device 010: ID 0cad:9013 Motorola CGISS TETRA PEI interface
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass            0
        bDeviceSubClass         0
        bDeviceProtocol         0
        bMaxPacketSize0        64
        idVendor           0x0cad Motorola CGISS
        idProduct          0x9013
        bcdDevice           24.16
        iManufacturer           1
        iProduct                2
        iSerial                 0
        bNumConfigurations      1
        Configuration Descriptor:
          bLength                 9
          bDescriptorType         2
          wTotalLength       0x0037
          bNumInterfaces          2
          bConfigurationValue     1
          iConfiguration          3
          bmAttributes         0x80
            (Bus Powered)
          MaxPower              500mA
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass       255 Vendor Specific Class
            bInterfaceSubClass      0
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x81  EP 1 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x01  EP 1 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        1
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass       255 Vendor Specific Class
            bInterfaceSubClass      0
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x82  EP 2 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x02  EP 2 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
      Signed-off-by: default avatarJerónimo Borque <jeronimo@borque.com.ar>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      69874bf1
    • Lars Möllendorf's avatar
      iio: buffer: align the size of scan bytes to size of the largest element · e5d1fe94
      Lars Möllendorf authored
      commit 883f6165 upstream.
      
      Previous versions of `iio_compute_scan_bytes` only aligned each element
      to its own length (i.e. its own natural alignment). Because multiple
      consecutive sets of scan elements are buffered this does not work in
      case the computed scan bytes do not align with the natural alignment of
      the first scan element in the set.
      
      This commit fixes this by aligning the scan bytes to the natural
      alignment of the largest scan element in the set.
      
      Fixes: 959d2952 ("staging:iio: make iio_sw_buffer_preenable much more general.")
      Signed-off-by: default avatarLars Möllendorf <lars.moellendorf@plating.de>
      Reviewed-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      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>
      e5d1fe94
    • Stephan Gerhold's avatar
      ASoC: msm8916-wcd-digital: Reset RX interpolation path after use · 7acabcf1
      Stephan Gerhold authored
      commit 85578bbd upstream.
      
      For some reason, attempting to route audio through QDSP6 on MSM8916
      causes the RX interpolation path to get "stuck" after playing audio
      a few times. In this situation, the analog codec part is still working,
      but the RX path in the digital codec stops working, so you only hear
      the analog parts powering up. After a reboot everything works again.
      
      So far I was not able to reproduce the problem when using lpass-cpu.
      
      The downstream kernel driver avoids this by resetting the RX
      interpolation path after use. In mainline we do something similar
      for the TX decimator (LPASS_CDC_CLK_TX_RESET_B1_CTL), but the
      interpolator reset (LPASS_CDC_CLK_RX_RESET_CTL) got lost when the
      msm8916-wcd driver was split into analog and digital.
      
      Fix this problem by adding the reset to
      msm8916_wcd_digital_enable_interpolator().
      
      Fixes: 150db8c5 ("ASoC: codecs: Add msm8916-wcd digital codec")
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
      Link: https://lore.kernel.org/r/20200105102753.83108-1-stephan@gerhold.netSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7acabcf1
    • Guenter Roeck's avatar
      clk: Don't try to enable critical clocks if prepare failed · 5f047e38
      Guenter Roeck authored
      commit 12ead774 upstream.
      
      The following traceback is seen if a critical clock fails to prepare.
      
      bcm2835-clk 3f101000.cprman: plld: couldn't lock PLL
      ------------[ cut here ]------------
      Enabling unprepared plld_per
      WARNING: CPU: 1 PID: 1 at drivers/clk/clk.c:1014 clk_core_enable+0xcc/0x2c0
      ...
      Call trace:
       clk_core_enable+0xcc/0x2c0
       __clk_register+0x5c4/0x788
       devm_clk_hw_register+0x4c/0xb0
       bcm2835_register_pll_divider+0xc0/0x150
       bcm2835_clk_probe+0x134/0x1e8
       platform_drv_probe+0x50/0xa0
       really_probe+0xd4/0x308
       driver_probe_device+0x54/0xe8
       device_driver_attach+0x6c/0x78
       __driver_attach+0x54/0xd8
      ...
      
      Check return values from clk_core_prepare() and clk_core_enable() and
      bail out if any of those functions returns an error.
      
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Fixes: 99652a46 ("clk: migrate the count of orphaned clocks at init")
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Link: https://lkml.kernel.org/r/20191225163429.29694-1-linux@roeck-us.netSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5f047e38
    • Alexandre Belloni's avatar
      ARM: dts: imx6q-dhcom: fix rtc compatible · 8e1d9fc9
      Alexandre Belloni authored
      commit 7d7778b1 upstream.
      
      The only correct and documented compatible string for the rv3029 is
      microcrystal,rv3029. Fix it up.
      
      Fixes: 52c7a088 ("ARM: dts: imx6q: Add support for the DHCOM iMX6 SoM and PDK2")
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8e1d9fc9
    • Martin Blumenstingl's avatar
      dt-bindings: reset: meson8b: fix duplicate reset IDs · 09714577
      Martin Blumenstingl authored
      commit 4881873f upstream.
      
      According to the public S805 datasheet the RESET2 register uses the
      following bits for the PIC_DC, PSC and NAND reset lines:
      - PIC_DC is at bit 3 (meaning: RESET_VD_RMEM + 3)
      - PSC is at bit 4 (meaning: RESET_VD_RMEM + 4)
      - NAND is at bit 5 (meaning: RESET_VD_RMEM + 4)
      
      Update the reset IDs of these three reset lines so they don't conflict
      with PIC_DC and map to the actual hardware reset lines.
      
      Fixes: 79795e20 ("dt-bindings: reset: Add bindings for the Meson SoC Reset Controller")
      Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      09714577